Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3604c7464 | ||
|
|
10574748ff | ||
|
|
c7336dbcad | ||
|
|
ebeb69dd3a | ||
|
|
9ad40be210 | ||
|
|
df209f6515 | ||
|
|
d32d6b5474 | ||
|
|
623b7b775c |
No files matched your search
@@ -1,25 +1,27 @@
|
||||
# LuckPerms
|
||||
A (fairly bad) permissions implementation for Bukkit/BungeeCord.
|
||||
A permissions implementation for Bukkit/BungeeCord.
|
||||
|
||||
## Features
|
||||
* **Group inheritance** - users can be members of multiple groups, groups can inherit other groups
|
||||
* **Temporary permissions** - users/groups can be given permissions that expire after a given time
|
||||
* **Temporary groups** - users/groups can be added to/inherit other groups temporarily
|
||||
* **Multi-server support** - data is synced across all servers/platforms
|
||||
* **Full offline-mode/mixed-mode support** - player permissions are synced properly over offline-mode or mixed online/offline-mode networks.
|
||||
* **Per-server permissions/groups** - define user/group permissions that only apply on certain servers
|
||||
* **Server-specific groups** - define groups that only apply on certain servers
|
||||
* **Tracks / paths** - users can be promoted/demoted along multiple group tracks
|
||||
* **Per-world permissions/groups** - define user/group permissions that only apply on certain worlds (on BungeeCord, a connected Bukkit/Spigot instance is treated as a world)
|
||||
* **Tracks / paths / ladders** - users can be promoted/demoted along multiple group tracks
|
||||
* **Vault Support** - hooks into Vault to integrate with other plugins
|
||||
* **Developer API** - easily integrate LuckPerms into your own projects
|
||||
* **Easy and simple setup and configuration using commands** - no editing yml files, yuck
|
||||
* **Negated permissions and groups** - define special rules for certain users/groups
|
||||
* **Full support for UUIDs, even in Offline Mode** - users can change their usernames without losing permissions. In offline mode, a single user has the same internal UUID across a network.
|
||||
* **Permission data stored within MySQL in a json format** - easily integrate the LuckPerms backend into your other projects
|
||||
* **Well documented** - API methods have comprehensive Java docs, it's clear what each method does.
|
||||
* **Efficient/lightweight** - maybe? Who knows, it might be.
|
||||
* **Open Sourced, Free...** - you shouldn't have to pay $10+ for a "powerful" permissions plugin.
|
||||
* **BungeeCord compatible** - permissions, users and groups are synced across Bukkit/BungeeCord instances
|
||||
* **Support for MySQL, SQLite & Flatfile (JSON)** - other storage methods coming soon (maybe)
|
||||
|
||||
##### Possible Caveats
|
||||
* Currently only supports MySQL, SQLite & Flatfile (JSON) (support for more methods might come in the future)
|
||||
* Not at all tested and could produce unexpected/buggy results and errors
|
||||
|
||||
## Setup
|
||||
All configuration options are in the **config.yml** file, which is generated automagically when the plugin first starts.
|
||||
|
||||
@@ -33,13 +35,17 @@ Permissions are calculated based on a priority system as follows.
|
||||
|
||||
Example: if a user has a false permission set for "test.node", and a temporary true permission set for "test.node", the temporary permission will override the permanent one, and the user will be granted the true node.
|
||||
|
||||
* World specific permissions will override generic permissions.
|
||||
|
||||
Example: if a user has a global "fly.use" permission, and then has a negated "fly.use" permission in the "world_nether" world, the world specific permission will override the globally defined one, and the user will be granted the negated node (provided they're in that world, of course.).
|
||||
|
||||
* Server specific permissions will override generic/global permissions.
|
||||
|
||||
Example: if a user has a global "fly.use" permission, and then has a negated "fly.use" permission on the "factions" server, the server specific permission will override the globally defined one, and the user will be granted the negated node.
|
||||
|
||||
* Inherited permissions will be overridden by an objects own permissions.
|
||||
|
||||
Example: A user is a member of the default group, which grants "some.thing.perm", but the users own permissions has "some.thing.perm" set to false. The inherited permission will be overridden by the users own permissions, and the user will be granted the negative node.
|
||||
Example: A user is a member of the default group, which grants "some.thing.perm", but the users own permissions has "some.thing.perm" set to false. The inherited permission will be overridden by the users own permissions, and the user will be granted the negative node (provided they're on that server).
|
||||
|
||||
### Temporary Permissions
|
||||
Temporary permissions are checked each time a user/group is loaded, and when the sync task runs. This means if you set a temporary permission to expire after 30 seconds, it won't actually be removed until the sync task runs.
|
||||
@@ -74,7 +80,7 @@ Command usage is printed to the console/chat whenever invalid arguments are prov
|
||||
| /lp | /lpb |
|
||||
| /perm | /bperm |
|
||||
|
||||
Arguments: <required> [optional]
|
||||
Arguments: \<required\> [optional]
|
||||
|
||||
Users with OP have access to all commands.
|
||||
|
||||
@@ -89,55 +95,56 @@ Additionally, you can use wildcards to grant users access to a selection of comm
|
||||
* /perms sync - luckperms.sync
|
||||
* /perms info - luckperms.info
|
||||
* /perms debug - luckperms.debug
|
||||
* /perms creategroup <group> - luckperms.creategroup
|
||||
* /perms deletegroup <group> - luckperms.deletegroup
|
||||
* /perms creategroup \<group\> - luckperms.creategroup
|
||||
* /perms deletegroup \<group\> - luckperms.deletegroup
|
||||
* /perms listgroups - luckperms.listgroups
|
||||
* /perms createtrack <track> - luckperms.createtrack
|
||||
* /perms deletetrack <track> - luckperms.deletetrack
|
||||
* /perms createtrack \<track\> - luckperms.createtrack
|
||||
* /perms deletetrack \<track\> - luckperms.deletetrack
|
||||
* /perms listtracks - luckperms.listtracks
|
||||
|
||||
### User
|
||||
* /perms user <user> info - luckperms.user.info
|
||||
* /perms user <user> getuuid - luckperms.user.getuuid
|
||||
* /perms user <user> listnodes - luckperms.user.listnodes
|
||||
* /perms user <user> haspermission <node> [server] - luckperms.user.haspermission
|
||||
* /perms user <user> inheritspermission <node> [server] - luckperms.user.inheritspermission
|
||||
* /perms user <user> set <node> <true/false> [server] - luckperms.user.setpermission
|
||||
* /perms user <user> unset <node> [server] - luckperms.user.unsetpermission
|
||||
* /perms user <user> addgroup <group> [server] - luckperms.user.addgroup
|
||||
* /perms user <user> removegroup <group> [server] - luckperms.user.removegroup
|
||||
* /perms user <user> settemp <node> <true/false> <duration> [server] - luckperms.user.settemppermission
|
||||
* /perms user <user> addtempgroup <group> <duration> [server] - luckperms.user.addtempgroup
|
||||
* /perms user <user> removetempgroup <group> [server] - luckperms.user.removetempgroup
|
||||
* /perms user <user> setprimarygroup <group> - luckperms.user.setprimarygroup
|
||||
* /perms user <user> showtracks - luckperms.user.showtracks
|
||||
* /perms user <user> promote <track> - luckperms.user.promote
|
||||
* /perms user <user> demote <track> - luckperms.user.demote
|
||||
* /perms user <user> showpos <track> - luckperms.user.showpos
|
||||
* /perms user <user> clear - luckperms.user.clear
|
||||
* /perms user \<user\> info - luckperms.user.info
|
||||
* /perms user \<user\> getuuid - luckperms.user.getuuid
|
||||
* /perms user \<user\> listnodes - luckperms.user.listnodes
|
||||
* /perms user \<user\> haspermission \<node\> [server] [world] - luckperms.user.haspermission
|
||||
* /perms user \<user\> inheritspermission \<node\> [server] [world] - luckperms.user.inheritspermission
|
||||
* /perms user \<user\> set \<node\> \<true/false\> [server] [world] - luckperms.user.setpermission
|
||||
* /perms user \<user\> unset \<node\> [server] [world] - luckperms.user.unsetpermission
|
||||
* /perms user \<user\> addgroup \<group\> [server] [world] - luckperms.user.addgroup
|
||||
* /perms user \<user\> removegroup \<group\> [server] [world] - luckperms.user.removegroup
|
||||
* /perms user \<user\> settemp \<node\> \<true/false\> \<duration\> [server] [world] - luckperms.user.settemppermission
|
||||
* /perms user \<user\> unsettemp \<node\> [server] [world] - luckperms.user.unsettemppermission
|
||||
* /perms user \<user\> addtempgroup \<group\> \<duration\> [server] [world] - luckperms.user.addtempgroup
|
||||
* /perms user \<user\> removetempgroup \<group\> [server] [world] - luckperms.user.removetempgroup
|
||||
* /perms user \<user\> setprimarygroup \<group\> - luckperms.user.setprimarygroup
|
||||
* /perms user \<user\> showtracks - luckperms.user.showtracks
|
||||
* /perms user \<user\> promote \<track\> - luckperms.user.promote
|
||||
* /perms user \<user\> demote \<track\> - luckperms.user.demote
|
||||
* /perms user \<user\> showpos \<track\> - luckperms.user.showpos
|
||||
* /perms user \<user\> clear - luckperms.user.clear
|
||||
|
||||
### Group
|
||||
* /perms group <group> info - luckperms.group.info
|
||||
* /perms group <group> listnodes - luckperms.group.listnodes
|
||||
* /perms group <group> haspermission <node> [server] - luckperms.group.haspermission
|
||||
* /perms group <group> inheritspermission <node> [server] - luckperms.group.inheritspermission
|
||||
* /perms group <group> set <node> <true/false> [server] - luckperms.group.setpermission
|
||||
* /perms group <group> unset <node> [server] - luckperms.group.unsetpermission
|
||||
* /perms group <group> setinherit <group> [server] - luckperms.group.setinherit
|
||||
* /perms group <group> unsetinherit <group> [server] - luckperms.group.unsetinherit
|
||||
* /perms group <group> settemp <node> <true/false> <duration> [server] - settemppermission
|
||||
* /perms group <group> unsettemp <node> [server] - luckperms.group.unsettemppermission
|
||||
* /perms group <group> settempinherit <group> <duration> [server] - luckperms.group.settempinherit
|
||||
* /perms group <group> unsettempinherit <group> [server] - luckperms.group.unsettempinherit
|
||||
* /perms group <group> showtracks - luckperms.group.showtracks
|
||||
* /perms group <group> clear - luckperms.group.clear
|
||||
* /perms group \<group\> info - luckperms.group.info
|
||||
* /perms group \<group\> listnodes - luckperms.group.listnodes
|
||||
* /perms group \<group\> haspermission \<node\> [server] [world] - luckperms.group.haspermission
|
||||
* /perms group \<group\> inheritspermission \<node\> [server] [world] - luckperms.group.inheritspermission
|
||||
* /perms group \<group\> set \<node\> \<true/false\> [server] [world] - luckperms.group.setpermission
|
||||
* /perms group \<group\> unset \<node\> [server] [world] - luckperms.group.unsetpermission
|
||||
* /perms group \<group\> setinherit \<group\> [server] [world] - luckperms.group.setinherit
|
||||
* /perms group \<group\> unsetinherit \<group\> [server] [world] - luckperms.group.unsetinherit
|
||||
* /perms group \<group\> settemp \<node\> \<true/false\> \<duration\> [server] [world] - settemppermission
|
||||
* /perms group \<group\> unsettemp \<node\> [server] [world] - luckperms.group.unsettemppermission
|
||||
* /perms group \<group\> settempinherit \<group\> \<duration\> [server] [world] - luckperms.group.settempinherit
|
||||
* /perms group \<group\> unsettempinherit \<group\> [server] [world] - luckperms.group.unsettempinherit
|
||||
* /perms group \<group\> showtracks - luckperms.group.showtracks
|
||||
* /perms group \<group\> clear - luckperms.group.clear
|
||||
|
||||
### Track
|
||||
* /perms track <track> info - luckperms.track.info
|
||||
* /perms track <track> append <group> - luckperms.track.append
|
||||
* /perms track <track> insert <group> <position> - luckperms.track.insert
|
||||
* /perms track <track> remove <group> - luckperms.track.remove
|
||||
* /perms track <track> clear - luckperms.track.clear
|
||||
* /perms track \<track\> info - luckperms.track.info
|
||||
* /perms track \<track\> append \<group\> - luckperms.track.append
|
||||
* /perms track \<track\> insert \<group\> \<position\> - luckperms.track.insert
|
||||
* /perms track \<track\> remove \<group\> - luckperms.track.remove
|
||||
* /perms track \<track\> clear - luckperms.track.clear
|
||||
|
||||
## License
|
||||
See LICENSE.md.
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko</groupId>
|
||||
<version>1.3</version>
|
||||
<version>${global.version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -19,21 +19,21 @@ public interface Datastore {
|
||||
Sync sync();
|
||||
|
||||
interface Async {
|
||||
void loadOrCreateUser(UUID uuid, String username, Callback callback);
|
||||
void loadUser(UUID uuid, Callback callback);
|
||||
void saveUser(User user, Callback callback);
|
||||
void createAndLoadGroup(String name, Callback callback);
|
||||
void loadGroup(String name, Callback callback);
|
||||
void loadAllGroups(Callback callback);
|
||||
void saveGroup(Group group, Callback callback);
|
||||
void deleteGroup(Group group, Callback callback);
|
||||
void createAndLoadTrack(String name, Callback callback);
|
||||
void loadTrack(String name, Callback callback);
|
||||
void loadAllTracks(Callback callback);
|
||||
void saveTrack(Track track, Callback callback);
|
||||
void deleteTrack(Track track, Callback callback);
|
||||
void saveUUIDData(String username, UUID uuid, Callback callback);
|
||||
void getUUID(String username, Callback.GetUUID callback);
|
||||
void loadOrCreateUser(UUID uuid, String username, Callback<Boolean> callback);
|
||||
void loadUser(UUID uuid, Callback<Boolean> callback);
|
||||
void saveUser(User user, Callback<Boolean> callback);
|
||||
void createAndLoadGroup(String name, Callback<Boolean> callback);
|
||||
void loadGroup(String name, Callback<Boolean> callback);
|
||||
void loadAllGroups(Callback<Boolean> callback);
|
||||
void saveGroup(Group group, Callback<Boolean> callback);
|
||||
void deleteGroup(Group group, Callback<Boolean> callback);
|
||||
void createAndLoadTrack(String name, Callback<Boolean> callback);
|
||||
void loadTrack(String name, Callback<Boolean> callback);
|
||||
void loadAllTracks(Callback<Boolean> callback);
|
||||
void saveTrack(Track track, Callback<Boolean> callback);
|
||||
void deleteTrack(Track track, Callback<Boolean> callback);
|
||||
void saveUUIDData(String username, UUID uuid, Callback<Boolean> callback);
|
||||
void getUUID(String username, Callback<UUID> callback);
|
||||
}
|
||||
|
||||
interface Sync {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper interface for internal Group instances
|
||||
* The implementations of this interface limit access to the Group and add parameter checks to further prevent
|
||||
@@ -8,11 +13,159 @@ package me.lucko.luckperms.api;
|
||||
@SuppressWarnings("unused")
|
||||
public interface Group extends PermissionObject {
|
||||
|
||||
/**
|
||||
* @return the name of the group
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* check to see if a group inherits a group
|
||||
* @param group The group to check membership of
|
||||
* @return true if the user is a member of the group
|
||||
*/
|
||||
boolean inheritsGroup(Group group);
|
||||
|
||||
/**
|
||||
* check to see if the group inherits a group on a specific server
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @return true if the group inherits the group
|
||||
*/
|
||||
boolean inheritsGroup(Group group, String server);
|
||||
|
||||
/**
|
||||
* check to see if the group inherits a group on a specific server
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @return true if the group inherits the group
|
||||
*/
|
||||
boolean inheritsGroup(Group group, String server, String world);
|
||||
|
||||
/**
|
||||
* Make this group inherit another group
|
||||
* @param group the group to be inherited
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group
|
||||
*/
|
||||
void setInheritGroup(Group group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
void setInheritGroup(Group group, String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
void setInheritGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
void setInheritGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
void setInheritGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
void setInheritGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
void unsetInheritGroup(Group group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
void unsetInheritGroup(Group group, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server, String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Clear all of the groups permission nodes
|
||||
*/
|
||||
void clearNodes();
|
||||
|
||||
/**
|
||||
* Get a {@link List} of all of the groups the group inherits, on all servers
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
List<String> getGroupNames();
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
List<String> getLocalGroups(String server, String world);
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
List<String> getLocalGroups(String server);
|
||||
}
|
||||
@@ -35,6 +35,16 @@ public interface PermissionObject {
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @return true if the user has the permission
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server, String world);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
@@ -44,6 +54,27 @@ public interface PermissionObject {
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server to check on
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user has the permission
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user has the permission
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server, String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
@@ -61,6 +92,16 @@ public interface PermissionObject {
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server);
|
||||
|
||||
/**
|
||||
* Checks to see the the object inherits a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server, String world);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
@@ -70,6 +111,27 @@ public interface PermissionObject {
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server, String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to be set
|
||||
@@ -87,6 +149,16 @@ public interface PermissionObject {
|
||||
*/
|
||||
void setPermission(String node, boolean value, String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param world The world to set the permission on
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
*/
|
||||
void setPermission(String node, boolean value, String server, String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to set
|
||||
@@ -106,6 +178,17 @@ public interface PermissionObject {
|
||||
*/
|
||||
void setPermission(String node, boolean value, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param world The world to set the permission on
|
||||
* @param expireAt The time in unixtime when the permission will expire
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
*/
|
||||
void setPermission(String node, boolean value, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
@@ -129,6 +212,15 @@ public interface PermissionObject {
|
||||
*/
|
||||
void unsetPermission(String node, String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param world The world to unset the node on
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
*/
|
||||
void unsetPermission(String node, String server, String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
@@ -138,6 +230,25 @@ public interface PermissionObject {
|
||||
*/
|
||||
void unsetPermission(String node, String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param world The world to unset the node on
|
||||
* @param temporary if the permission being unset is temporary
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
*/
|
||||
void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server
|
||||
* @param server The server to get nodes for
|
||||
* @param world The world to get nodes for
|
||||
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
|
||||
* @return a {@link Map} of the permissions
|
||||
*/
|
||||
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups);
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server
|
||||
* @param server The server to get nodes for (can be null)
|
||||
|
||||
@@ -14,10 +14,32 @@ import java.util.UUID;
|
||||
@SuppressWarnings("unused")
|
||||
public interface User extends PermissionObject {
|
||||
|
||||
/**
|
||||
* @return the users Mojang assigned unique id
|
||||
*/
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
* @return the Users Username
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the users primary group
|
||||
* @return the users primary group
|
||||
*/
|
||||
String getPrimaryGroup();
|
||||
|
||||
/**
|
||||
* Sets a users primary group
|
||||
* @param s the new primary group
|
||||
* @throws ObjectAlreadyHasException if the user already has this set as their primary group
|
||||
*/
|
||||
void setPrimaryGroup(String s) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Refresh and re-assign the users permissions
|
||||
*/
|
||||
void refreshPermissions();
|
||||
|
||||
/**
|
||||
@@ -35,6 +57,15 @@ public interface User extends PermissionObject {
|
||||
*/
|
||||
boolean isInGroup(Group group, String server);
|
||||
|
||||
/**
|
||||
* Check to see if a user is a member of a group on a specific server
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @return true if the user is a member of the group
|
||||
*/
|
||||
boolean isInGroup(Group group, String server, String world);
|
||||
|
||||
/**
|
||||
* Add a user to a group
|
||||
* @param group The group to add the user to
|
||||
@@ -50,6 +81,15 @@ public interface User extends PermissionObject {
|
||||
*/
|
||||
void addGroup(Group group, String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
*/
|
||||
void addGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
* @param group The group to add the user to
|
||||
@@ -67,6 +107,16 @@ public interface User extends PermissionObject {
|
||||
*/
|
||||
void addGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
*/
|
||||
void addGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group the group to remove the user from
|
||||
@@ -90,6 +140,15 @@ public interface User extends PermissionObject {
|
||||
*/
|
||||
void removeGroup(Group group, String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
*/
|
||||
void removeGroup(Group group, String server, String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group The group to remove the user from
|
||||
@@ -99,6 +158,16 @@ public interface User extends PermissionObject {
|
||||
*/
|
||||
void removeGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
*/
|
||||
void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Clear all of the users permission nodes
|
||||
*/
|
||||
@@ -110,6 +179,13 @@ public interface User extends PermissionObject {
|
||||
*/
|
||||
List<String> getGroupNames();
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
List<String> getLocalGroups(String server, String world);
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
* @param server the server to check
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package me.lucko.luckperms.api.data;
|
||||
|
||||
import java.util.UUID;
|
||||
public interface Callback<T> {
|
||||
|
||||
public interface Callback {
|
||||
void onComplete(boolean success);
|
||||
void onComplete(T t);
|
||||
|
||||
interface GetUUID {
|
||||
void onComplete(UUID uuid);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko</groupId>
|
||||
<version>1.3</version>
|
||||
<version>${global.version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package me.lucko.luckperms;
|
||||
import lombok.Getter;
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
import me.lucko.luckperms.api.implementation.ApiProvider;
|
||||
import me.lucko.luckperms.api.vault.VaultHook;
|
||||
import me.lucko.luckperms.data.Datastore;
|
||||
import me.lucko.luckperms.data.MySQLConfiguration;
|
||||
import me.lucko.luckperms.data.methods.FlatfileDatastore;
|
||||
@@ -15,7 +16,7 @@ import me.lucko.luckperms.tracks.TrackManager;
|
||||
import me.lucko.luckperms.users.BukkitUserManager;
|
||||
import me.lucko.luckperms.users.UserManager;
|
||||
import me.lucko.luckperms.utils.LPConfiguration;
|
||||
import me.lucko.luckperms.vaulthooks.VaultHook;
|
||||
import me.lucko.luckperms.utils.UuidCache;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -31,13 +32,12 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
public static final String VERSION = "v1.3";
|
||||
|
||||
private LPConfiguration configuration;
|
||||
private UserManager userManager;
|
||||
private GroupManager groupManager;
|
||||
private TrackManager trackManager;
|
||||
private Datastore datastore;
|
||||
private UuidCache uuidCache;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -81,6 +81,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
datastore.init();
|
||||
|
||||
getLogger().info("Loading internal permission managers...");
|
||||
uuidCache = new UuidCache(getConfiguration().getOnlineMode());
|
||||
userManager = new BukkitUserManager(this);
|
||||
groupManager = new GroupManager(this);
|
||||
trackManager = new TrackManager();
|
||||
@@ -143,12 +144,12 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return VERSION;
|
||||
return getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerStatus(UUID uuid) {
|
||||
return getServer().getPlayer(uuid) != null ? "&aOnline" : "&cOffline";
|
||||
return getServer().getPlayer(getUuidCache().getExternalUUID(uuid)) != null ? "&aOnline" : "&cOffline";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.lucko.luckperms.vaulthooks;
|
||||
package me.lucko.luckperms.api.vault;
|
||||
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package me.lucko.luckperms.vaulthooks;
|
||||
package me.lucko.luckperms.api.vault;
|
||||
|
||||
import me.lucko.luckperms.LPBukkitPlugin;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
@@ -0,0 +1,197 @@
|
||||
package me.lucko.luckperms.api.vault;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import me.lucko.luckperms.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.PermissionObject;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class VaultPermissionHook extends Permission {
|
||||
|
||||
@Setter
|
||||
private LPBukkitPlugin plugin;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "LuckPerms";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return plugin.getDatastore().isAcceptingLogins();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperPermsCompat() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean objectHas(String world, PermissionObject object, String permission) {
|
||||
if (object == null) return false;
|
||||
|
||||
if (world != null && !world.equals("")) {
|
||||
return object.hasPermission(permission, true, "global", world);
|
||||
} else {
|
||||
return object.hasPermission(permission, true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean objectAdd(String world, PermissionObject object, String permission) {
|
||||
if (object == null) return false;
|
||||
|
||||
try {
|
||||
if (world != null && !world.equals("")) {
|
||||
object.setPermission(permission, true, "global", world);
|
||||
} else {
|
||||
object.setPermission(permission, true);
|
||||
}
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
|
||||
objectSave(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean objectRemove(String world, PermissionObject object, String permission) {
|
||||
if (object == null) return false;
|
||||
|
||||
try {
|
||||
if (world != null && !world.equals("")) {
|
||||
object.unsetPermission(permission, "global", world);
|
||||
} else {
|
||||
object.unsetPermission(permission);
|
||||
}
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
|
||||
objectSave(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void objectSave(PermissionObject t) {
|
||||
if (t instanceof User) {
|
||||
((User) t).refreshPermissions();
|
||||
plugin.getDatastore().saveUser(((User) t), aBoolean -> {});
|
||||
}
|
||||
if (t instanceof Group) {
|
||||
plugin.getDatastore().saveGroup(((Group) t), aBoolean -> plugin.runUpdateTask());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String world, @NonNull String player, @NonNull String permission) {
|
||||
return objectHas(world, plugin.getUserManager().getUser(player), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, @NonNull String player, @NonNull String permission) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return objectAdd(world, user, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String world, @NonNull String player, @NonNull String permission) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return objectRemove(world, user, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String world, @NonNull String groupName, @NonNull String permission) {
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
return objectHas(world, group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String world, @NonNull String groupName, @NonNull String permission) {
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
return objectAdd(world, group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String world, @NonNull String groupName, @NonNull String permission) {
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
return objectRemove(world, group, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, @NonNull String player, @NonNull String group) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
final Group group1 = plugin.getGroupManager().getGroup(group);
|
||||
if (group1 == null) return false;
|
||||
|
||||
if (world != null && !world.equals("")) {
|
||||
return user.isInGroup(group1, "global", world);
|
||||
} else {
|
||||
return user.isInGroup(group1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, @NonNull String player, @NonNull String groupName) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) return false;
|
||||
|
||||
try {
|
||||
if (world != null && !world.equals("")) {
|
||||
user.addGroup(group, "global", world);
|
||||
} else {
|
||||
user.addGroup(group);
|
||||
}
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
objectSave(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, @NonNull String player, @NonNull String groupName) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) return false;
|
||||
|
||||
try {
|
||||
if (world != null && !world.equals("")) {
|
||||
user.removeGroup(group, "global", world);
|
||||
} else {
|
||||
user.removeGroup(group);
|
||||
}
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
objectSave(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, @NonNull String player) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return (user == null) ? new String[0] :
|
||||
world != null && !world.equals("") ? user.getLocalGroups("global", world).toArray(new String[0]) :
|
||||
user.getGroupNames().toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, @NonNull String player) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return (user == null) ? null : user.getPrimaryGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return plugin.getGroupManager().getGroups().keySet().toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroupSupport() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.users.BukkitUser;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.UuidCache;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class PlayerListener implements Listener {
|
||||
@@ -26,13 +26,29 @@ public class PlayerListener implements Listener {
|
||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, KICK_MESSAGE);
|
||||
return;
|
||||
}
|
||||
plugin.getDatastore().loadOrCreateUser(e.getUniqueId(), e.getName());
|
||||
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
if (!cache.isOnlineMode()) {
|
||||
UUID uuid = plugin.getDatastore().getUUID(e.getName());
|
||||
if (uuid != null) {
|
||||
cache.addToCache(e.getUniqueId(), uuid);
|
||||
} else {
|
||||
// No previous data for this player
|
||||
cache.addToCache(e.getUniqueId(), e.getUniqueId());
|
||||
plugin.getDatastore().saveUUIDData(e.getName(), e.getUniqueId(), b -> {});
|
||||
}
|
||||
} else {
|
||||
// Online mode, no cache needed. This is just for name -> uuid lookup.
|
||||
plugin.getDatastore().saveUUIDData(e.getName(), e.getUniqueId(), b -> {});
|
||||
}
|
||||
|
||||
plugin.getDatastore().loadOrCreateUser(cache.getUUID(e.getUniqueId()), e.getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLogin(PlayerLoginEvent e) {
|
||||
final Player player = e.getPlayer();
|
||||
final User user = plugin.getUserManager().getUser(player.getUniqueId());
|
||||
final User user = plugin.getUserManager().getUser(plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId()));
|
||||
|
||||
if (user == null) {
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, KICK_MESSAGE);
|
||||
@@ -49,24 +65,32 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||
// Save UUID data for the player
|
||||
plugin.getDatastore().saveUUIDData(e.getPlayer().getName(), e.getPlayer().getUniqueId(), success -> {});
|
||||
|
||||
final User user = plugin.getUserManager().getUser(e.getPlayer().getUniqueId());
|
||||
if (user != null) {
|
||||
// Refresh permissions again
|
||||
user.refreshPermissions();
|
||||
}
|
||||
|
||||
// Refresh permissions again
|
||||
refreshPlayer(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent e) {
|
||||
final Player player = e.getPlayer();
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
|
||||
// Unload the user from memory when they disconnect
|
||||
final User user = plugin.getUserManager().getUser(player.getUniqueId());
|
||||
// Unload the user from memory when they disconnect;
|
||||
cache.clearCache(player.getUniqueId());
|
||||
|
||||
final User user = plugin.getUserManager().getUser(cache.getUUID(player.getUniqueId()));
|
||||
plugin.getUserManager().unloadUser(user);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChangedWorld(PlayerChangedWorldEvent e) {
|
||||
refreshPlayer(e.getPlayer());
|
||||
}
|
||||
|
||||
private void refreshPlayer(Player p) {
|
||||
final User user = plugin.getUserManager().getUser(plugin.getUuidCache().getUUID(p.getUniqueId()));
|
||||
if (user != null) {
|
||||
user.refreshPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class BukkitUser extends User {
|
||||
@Override
|
||||
public void refreshPermissions() {
|
||||
plugin.doSync(() -> {
|
||||
final Player player = plugin.getServer().getPlayer(getUuid());
|
||||
final Player player = plugin.getServer().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
|
||||
if (player == null) return;
|
||||
|
||||
if (attachment == null) {
|
||||
@@ -42,7 +42,7 @@ public class BukkitUser extends User {
|
||||
attachment.getPermissions().keySet().forEach(p -> attachment.setPermission(p, false));
|
||||
|
||||
// Re-add all defined permissions for the user
|
||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), null);
|
||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), player.getWorld().getName(), null);
|
||||
local.entrySet().forEach(e -> attachment.setPermission(e.getKey(), e.getValue()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package me.lucko.luckperms.users;
|
||||
import me.lucko.luckperms.LPBukkitPlugin;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BukkitUserManager extends UserManager {
|
||||
private final LPBukkitPlugin plugin;
|
||||
@@ -21,7 +23,7 @@ public class BukkitUserManager extends UserManager {
|
||||
BukkitUser u = (BukkitUser) user;
|
||||
|
||||
if (u.getAttachment() != null) {
|
||||
Player player = plugin.getServer().getPlayer(u.getUuid());
|
||||
Player player = plugin.getServer().getPlayer(plugin.getUuidCache().getExternalUUID(u.getUuid()));
|
||||
|
||||
if (player != null) {
|
||||
player.removeAttachment(u.getAttachment());
|
||||
@@ -36,7 +38,7 @@ public class BukkitUserManager extends UserManager {
|
||||
|
||||
@Override
|
||||
public void cleanupUser(User user) {
|
||||
if (plugin.getServer().getPlayer(user.getUuid()) == null) {
|
||||
if (plugin.getServer().getPlayer(plugin.getUuidCache().getExternalUUID(user.getUuid())) == null) {
|
||||
unloadUser(user);
|
||||
}
|
||||
}
|
||||
@@ -53,6 +55,12 @@ public class BukkitUserManager extends UserManager {
|
||||
|
||||
@Override
|
||||
public void updateAllUsers() {
|
||||
plugin.getServer().getOnlinePlayers().stream().map(Player::getUniqueId).forEach(u -> plugin.getDatastore().loadUser(u));
|
||||
// Sometimes called async, so we need to get the players on the Bukkit thread.
|
||||
plugin.doSync(() -> {
|
||||
Set<UUID> players = plugin.getServer().getOnlinePlayers().stream()
|
||||
.map(p -> plugin.getUuidCache().getUUID(p.getUniqueId()))
|
||||
.collect(Collectors.toSet());
|
||||
plugin.doAsync(() -> players.forEach(u -> plugin.getDatastore().loadUser(u)));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package me.lucko.luckperms.vaulthooks;
|
||||
|
||||
import lombok.Setter;
|
||||
import me.lucko.luckperms.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
class VaultPermissionHook extends Permission {
|
||||
|
||||
@Setter
|
||||
private LPBukkitPlugin plugin;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "LuckPerms";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return plugin.getDatastore().isAcceptingLogins();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperPermsCompat() {
|
||||
// Idk???
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String world, String player, String permission) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return user != null && user.hasPermission(permission, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAdd(String world, String player, String permission) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
try {
|
||||
user.setPermission(permission, true);
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
plugin.getUserManager().saveUser(user, plugin.getDatastore());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemove(String world, String player, String permission) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
try {
|
||||
user.unsetPermission(permission);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
plugin.getUserManager().saveUser(user, plugin.getDatastore());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String world, String groupName, String permission) {
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
return group != null && group.hasPermission(permission, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String world, String groupName, String permission) {
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) return false;
|
||||
|
||||
try {
|
||||
group.setPermission(permission, true);
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
plugin.runUpdateTask();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String world, String groupName, String permission) {
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) return false;
|
||||
|
||||
try {
|
||||
group.unsetPermission(permission);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
plugin.runUpdateTask();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerInGroup(String world, String player, String group) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
final Group group1 = plugin.getGroupManager().getGroup(group);
|
||||
return group1 != null && user.isInGroup(group1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, String player, String groupName) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) return false;
|
||||
|
||||
try {
|
||||
user.addGroup(group);
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
plugin.getUserManager().saveUser(user, plugin.getDatastore());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, String player, String groupName) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
if (user == null) return false;
|
||||
|
||||
final Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) return false;
|
||||
|
||||
try {
|
||||
user.removeGroup(group);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
plugin.getUserManager().saveUser(user, plugin.getDatastore());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPlayerGroups(String world, String player) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return (user == null) ? new String[0] : user.getGroupNames().toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryGroup(String world, String player) {
|
||||
final User user = plugin.getUserManager().getUser(player);
|
||||
return (user == null) ? null : user.getPrimaryGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
return plugin.getGroupManager().getGroups().keySet().toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGroupSupport() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,19 @@ default-group: default
|
||||
# If users on this server should have their global permissions/groups applied.
|
||||
include-global: true
|
||||
|
||||
# If this server is in offline or online mode.
|
||||
# This setting allows a player to have the same UUID across a network of offline mode/mixed servers.
|
||||
|
||||
# You should generally reflect the setting in server.properties here. Except when...
|
||||
|
||||
# 1. You have Spigot servers connected to a BungeeCord proxy, with online-mode set to false, but 'bungeecord' set to true in the spigot.yml
|
||||
# AND 'ip-forward' set to true in the BungeeCord config.yml
|
||||
# In this case, set online-mode in LuckPerms to true, dispite the server being in offline mode.
|
||||
|
||||
# 2. You are only running one server instance using LuckPerms, (not a network)
|
||||
# In this case, set online-mode to true no matter what is set in server.properties. (we can just fallback to the servers uuid cache)
|
||||
online-mode: true
|
||||
|
||||
# Which storage method the plugin should use.
|
||||
# Currently supported: mysql, sqlite, flatfile
|
||||
# Fill out connection info below if you're using MySQL
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: LuckPerms
|
||||
author: Luck
|
||||
version: 1.2
|
||||
version: ${global.version}
|
||||
main: me.lucko.luckperms.LPBukkitPlugin
|
||||
softdepend: [Vault]
|
||||
description: A permissions plugin
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko</groupId>
|
||||
<version>1.3</version>
|
||||
<version>${global.version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import me.lucko.luckperms.tracks.TrackManager;
|
||||
import me.lucko.luckperms.users.BungeeUserManager;
|
||||
import me.lucko.luckperms.users.UserManager;
|
||||
import me.lucko.luckperms.utils.LPConfiguration;
|
||||
import me.lucko.luckperms.utils.UuidCache;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
@@ -24,13 +25,12 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
public static final String VERSION = "v1.3";
|
||||
|
||||
private LPConfiguration configuration;
|
||||
private UserManager userManager;
|
||||
private GroupManager groupManager;
|
||||
private TrackManager trackManager;
|
||||
private Datastore datastore;
|
||||
private UuidCache uuidCache;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -69,6 +69,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
datastore.init();
|
||||
|
||||
getLogger().info("Loading internal permission managers...");
|
||||
uuidCache = new UuidCache(getConfiguration().getOnlineMode());
|
||||
userManager = new BungeeUserManager(this);
|
||||
groupManager = new GroupManager(this);
|
||||
trackManager = new TrackManager();
|
||||
@@ -103,12 +104,12 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return VERSION;
|
||||
return getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerStatus(UUID uuid) {
|
||||
return getProxy().getPlayer(uuid) != null ? "&aOnline" : "&cOffline";
|
||||
return getProxy().getPlayer(getUuidCache().getExternalUUID(uuid)) != null ? "&aOnline" : "&cOffline";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,14 +5,19 @@ import me.lucko.luckperms.LPBungeePlugin;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.UuidCache;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.LoginEvent;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@AllArgsConstructor
|
||||
@@ -22,39 +27,72 @@ public class PlayerListener implements Listener {
|
||||
);
|
||||
private final LPBungeePlugin plugin;
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLogin(LoginEvent e) {
|
||||
/* Delay the login here, as we want to cache UUID data before the player is connected to a backend bukkit server.
|
||||
This means that a player will have the same UUID across the network, even if parts of the network are running in
|
||||
Offline mode. */
|
||||
e.registerIntent(plugin);
|
||||
plugin.doAsync(() -> {
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
final PendingConnection c = e.getConnection();
|
||||
|
||||
if (!cache.isOnlineMode()) {
|
||||
UUID uuid = plugin.getDatastore().getUUID(c.getName());
|
||||
if (uuid != null) {
|
||||
cache.addToCache(c.getUniqueId(), uuid);
|
||||
} else {
|
||||
// No previous data for this player
|
||||
cache.addToCache(c.getUniqueId(), c.getUniqueId());
|
||||
plugin.getDatastore().saveUUIDData(c.getName(), c.getUniqueId());
|
||||
}
|
||||
} else {
|
||||
// Online mode, no cache needed. This is just for name -> uuid lookup.
|
||||
plugin.getDatastore().saveUUIDData(c.getName(), c.getUniqueId());
|
||||
}
|
||||
|
||||
// We have to make a new user on this thread whilst the connection is being held, or we get concurrency issues as the Bukkit server
|
||||
// and the BungeeCord server try to make a new user at the same time.
|
||||
plugin.getDatastore().loadOrCreateUser(cache.getUUID(c.getUniqueId()), c.getName());
|
||||
e.completeIntent(plugin);
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerPostLogin(PostLoginEvent e) {
|
||||
final ProxiedPlayer player = e.getPlayer();
|
||||
final WeakReference<ProxiedPlayer> p = new WeakReference<>(player);
|
||||
|
||||
// Create user async and at post login. We're not concerned if data couldn't be loaded, the player won't be kicked.
|
||||
plugin.getDatastore().loadOrCreateUser(player.getUniqueId(), player.getName(), success -> {
|
||||
if (!success) {
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
final ProxiedPlayer pl = p.get();
|
||||
if (pl != null) {
|
||||
pl.sendMessage(WARN_MESSAGE);
|
||||
}
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
|
||||
} else {
|
||||
final User user = plugin.getUserManager().getUser(plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId()));
|
||||
if (user == null) {
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
final ProxiedPlayer pl = p.get();
|
||||
if (pl != null) {
|
||||
final User user = plugin.getUserManager().getUser(pl.getUniqueId());
|
||||
user.refreshPermissions();
|
||||
pl.sendMessage(WARN_MESSAGE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getDatastore().saveUUIDData(player.getName(), player.getUniqueId(), success -> {});
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
} else {
|
||||
user.refreshPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerDisconnectEvent e) {
|
||||
final ProxiedPlayer player = e.getPlayer();
|
||||
final UuidCache cache = plugin.getUuidCache();
|
||||
|
||||
// Unload the user from memory when they disconnect
|
||||
final User user = plugin.getUserManager().getUser(player.getUniqueId());
|
||||
// Unload the user from memory when they disconnect;
|
||||
cache.clearCache(player.getUniqueId());
|
||||
|
||||
final User user = plugin.getUserManager().getUser(cache.getUUID(player.getUniqueId()));
|
||||
plugin.getUserManager().unloadUser(user);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerServerSwitch(ServerSwitchEvent e) {
|
||||
final User user = plugin.getUserManager().getUser(plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId()));
|
||||
if (user != null) {
|
||||
user.refreshPermissions();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class BungeeUser extends User {
|
||||
|
||||
@Override
|
||||
public void refreshPermissions() {
|
||||
ProxiedPlayer player = plugin.getProxy().getPlayer(getUuid());
|
||||
ProxiedPlayer player = plugin.getProxy().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
|
||||
if (player == null) return;
|
||||
|
||||
// Clear existing permissions
|
||||
@@ -32,7 +32,8 @@ public class BungeeUser extends User {
|
||||
perms.forEach(p -> player.setPermission(p, false));
|
||||
|
||||
// Re-add all defined permissions for the user
|
||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), null);
|
||||
final String server = player.getServer() == null ? null : (player.getServer().getInfo() == null ? null : player.getServer().getInfo().getName());
|
||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), server, null);
|
||||
local.entrySet().forEach(e -> player.setPermission(e.getKey(), e.getValue()));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package me.lucko.luckperms.users;
|
||||
|
||||
import me.lucko.luckperms.LPBungeePlugin;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -24,7 +23,7 @@ public class BungeeUserManager extends UserManager {
|
||||
|
||||
@Override
|
||||
public void cleanupUser(User user) {
|
||||
if (plugin.getProxy().getPlayer(user.getUuid()) == null) {
|
||||
if (plugin.getProxy().getPlayer(plugin.getUuidCache().getExternalUUID(user.getUuid())) == null) {
|
||||
unloadUser(user);
|
||||
}
|
||||
}
|
||||
@@ -41,6 +40,8 @@ public class BungeeUserManager extends UserManager {
|
||||
|
||||
@Override
|
||||
public void updateAllUsers() {
|
||||
plugin.getProxy().getPlayers().stream().map(ProxiedPlayer::getUniqueId).forEach(u -> plugin.getDatastore().loadUser(u));
|
||||
plugin.getProxy().getPlayers().stream()
|
||||
.map(p -> plugin.getUuidCache().getUUID(p.getUniqueId()))
|
||||
.forEach(u -> plugin.getDatastore().loadUser(u));
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,19 @@ default-group: default
|
||||
# If users on this server should have their global permissions/groups applied.
|
||||
include-global: false
|
||||
|
||||
# If this server is in offline or online mode.
|
||||
# This setting allows a player to have the same UUID across a network of offline mode/mixed servers.
|
||||
|
||||
# You should generally reflect the setting in server.properties here. Except when...
|
||||
|
||||
# 1. You have Spigot servers connected to a BungeeCord proxy, with online-mode set to false, but 'bungeecord' set to true in the spigot.yml
|
||||
# AND 'ip-forward' set to true in the BungeeCord config.yml
|
||||
# In this case, set online-mode in LuckPerms to true, dispite the server being in offline mode.
|
||||
|
||||
# 2. You are only running one server instance using LuckPerms, (not a network)
|
||||
# In this case, set online-mode to true no matter what is set in server.properties. (we can just fallback to the servers uuid cache)
|
||||
online-mode: true
|
||||
|
||||
# Which storage method the plugin should use.
|
||||
# Currently supported: mysql & flatfile
|
||||
# Fill out connection info below if you're using MySQL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: LuckPerms
|
||||
author: Luck
|
||||
version: 1.2
|
||||
version: ${global.version}
|
||||
main: me.lucko.luckperms.LPBungeePlugin
|
||||
description: A permissions plugin
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko</groupId>
|
||||
<version>1.3</version>
|
||||
<version>${global.version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import me.lucko.luckperms.groups.GroupManager;
|
||||
import me.lucko.luckperms.tracks.TrackManager;
|
||||
import me.lucko.luckperms.users.UserManager;
|
||||
import me.lucko.luckperms.utils.LPConfiguration;
|
||||
import me.lucko.luckperms.utils.UuidCache;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -48,6 +49,12 @@ public interface LuckPermsPlugin {
|
||||
*/
|
||||
Logger getLogger();
|
||||
|
||||
/**
|
||||
* Retrieves the {@link UuidCache} for the plugin
|
||||
* @return the plugin's {@link UuidCache}
|
||||
*/
|
||||
UuidCache getUuidCache();
|
||||
|
||||
/**
|
||||
* @return the version of the plugin
|
||||
*/
|
||||
|
||||
+17
-25
@@ -43,18 +43,10 @@ public class DatastoreLink implements Datastore {
|
||||
return s.toLowerCase();
|
||||
}
|
||||
|
||||
private static Callback checkCallback(Callback c) {
|
||||
private static <T> Callback<T> checkCallback(Callback<T> c) {
|
||||
// If no callback was given, just send an empty one
|
||||
if (c == null) {
|
||||
c = success -> {};
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
private static Callback.GetUUID checkCallback(Callback.GetUUID c) {
|
||||
// If no callback was given, just send an empty one
|
||||
if (c == null) {
|
||||
c = success -> {};
|
||||
c = t -> {};
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -84,82 +76,82 @@ public class DatastoreLink implements Datastore {
|
||||
private final me.lucko.luckperms.data.Datastore master;
|
||||
|
||||
@Override
|
||||
public void loadOrCreateUser(@NonNull UUID uuid, @NonNull String username, Callback callback) {
|
||||
public void loadOrCreateUser(@NonNull UUID uuid, @NonNull String username, Callback<Boolean> callback) {
|
||||
master.loadOrCreateUser(uuid, checkUsername(username), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUser(@NonNull UUID uuid, Callback callback) {
|
||||
public void loadUser(@NonNull UUID uuid, Callback<Boolean> callback) {
|
||||
master.loadUser(uuid, checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveUser(@NonNull User user, Callback callback) {
|
||||
public void saveUser(@NonNull User user, Callback<Boolean> callback) {
|
||||
Utils.checkUser(user);
|
||||
master.saveUser(((UserLink) user).getMaster(), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAndLoadGroup(@NonNull String name, Callback callback) {
|
||||
public void createAndLoadGroup(@NonNull String name, Callback<Boolean> callback) {
|
||||
master.createAndLoadGroup(checkName(name), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadGroup(@NonNull String name, Callback callback) {
|
||||
public void loadGroup(@NonNull String name, Callback<Boolean> callback) {
|
||||
master.loadGroup(checkName(name), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllGroups(Callback callback) {
|
||||
public void loadAllGroups(Callback<Boolean> callback) {
|
||||
master.loadAllGroups(checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveGroup(@NonNull Group group, Callback callback) {
|
||||
public void saveGroup(@NonNull Group group, Callback<Boolean> callback) {
|
||||
Utils.checkGroup(group);
|
||||
master.saveGroup(((GroupLink) group).getMaster(), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGroup(@NonNull Group group, Callback callback) {
|
||||
public void deleteGroup(@NonNull Group group, Callback<Boolean> callback) {
|
||||
Utils.checkGroup(group);
|
||||
master.deleteGroup(((GroupLink) group).getMaster(), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAndLoadTrack(@NonNull String name, Callback callback) {
|
||||
public void createAndLoadTrack(@NonNull String name, Callback<Boolean> callback) {
|
||||
master.createAndLoadTrack(checkName(name), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTrack(@NonNull String name, Callback callback) {
|
||||
public void loadTrack(@NonNull String name, Callback<Boolean> callback) {
|
||||
master.loadTrack(checkName(name), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAllTracks(Callback callback) {
|
||||
public void loadAllTracks(Callback<Boolean> callback) {
|
||||
master.loadAllTracks(checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveTrack(@NonNull Track track, Callback callback) {
|
||||
public void saveTrack(@NonNull Track track, Callback<Boolean> callback) {
|
||||
Utils.checkTrack(track);
|
||||
master.saveTrack(((TrackLink) track).getMaster(), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTrack(@NonNull Track track, Callback callback) {
|
||||
public void deleteTrack(@NonNull Track track, Callback<Boolean> callback) {
|
||||
Utils.checkTrack(track);
|
||||
master.deleteTrack(((TrackLink) track).getMaster(), checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveUUIDData(@NonNull String username, @NonNull UUID uuid, Callback callback) {
|
||||
public void saveUUIDData(@NonNull String username, @NonNull UUID uuid, Callback<Boolean> callback) {
|
||||
master.saveUUIDData(checkUsername(username), uuid, checkCallback(callback));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUUID(@NonNull String username, Callback.GetUUID callback) {
|
||||
public void getUUID(@NonNull String username, Callback<UUID> callback) {
|
||||
master.getUUID(checkUsername(username), checkCallback(callback));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides a link between {@link Group} and {@link me.lucko.luckperms.groups.Group}
|
||||
@@ -24,8 +28,113 @@ public class GroupLink extends PermissionObjectLink implements Group {
|
||||
return master.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsGroup(@NonNull Group group) {
|
||||
Utils.checkGroup(group);
|
||||
return master.inheritsGroup(((GroupLink) group).getMaster());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsGroup(@NonNull Group group, @NonNull String server) {
|
||||
Utils.checkGroup(group);
|
||||
return master.inheritsGroup(((GroupLink) group).getMaster(), server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsGroup(@NonNull Group group, @NonNull String server, @NonNull String world) {
|
||||
Utils.checkGroup(group);
|
||||
return master.inheritsGroup(((GroupLink) group).getMaster(), server, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInheritGroup(@NonNull Group group) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.setInheritGroup(((GroupLink) group).getMaster());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInheritGroup(@NonNull Group group, @NonNull String server) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.setInheritGroup(((GroupLink) group).getMaster(), checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInheritGroup(@NonNull Group group, @NonNull String server, @NonNull String world) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.setInheritGroup(((GroupLink) group).getMaster(), checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInheritGroup(@NonNull Group group, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.setInheritGroup(((GroupLink) group).getMaster(), checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInheritGroup(@NonNull Group group, @NonNull String server, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.setInheritGroup(((GroupLink) group).getMaster(), checkServer(server), checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInheritGroup(@NonNull Group group, @NonNull String server, @NonNull String world, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.setInheritGroup(((GroupLink) group).getMaster(), checkServer(server), world, checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetInheritGroup(@NonNull Group group) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.unsetInheritGroup(((GroupLink) group).getMaster());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetInheritGroup(@NonNull Group group, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.unsetInheritGroup(((GroupLink) group).getMaster(), temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetInheritGroup(@NonNull Group group, @NonNull String server) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.unsetInheritGroup(((GroupLink) group).getMaster(), checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetInheritGroup(@NonNull Group group, @NonNull String server, @NonNull String world) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.unsetInheritGroup(((GroupLink) group).getMaster(), checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetInheritGroup(@NonNull Group group, @NonNull String server, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.unsetInheritGroup(((GroupLink) group).getMaster(), checkServer(server), temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetInheritGroup(@NonNull Group group, @NonNull String server, @NonNull String world, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.unsetInheritGroup(((GroupLink) group).getMaster(), checkServer(server), world, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearNodes() {
|
||||
master.clearNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroupNames() {
|
||||
return master.getGroupNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLocalGroups(@NonNull String server, @NonNull String world) {
|
||||
return master.getLocalGroups(checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLocalGroups(@NonNull String server) {
|
||||
return master.getLocalGroups(checkServer(server));
|
||||
}
|
||||
}
|
||||
+55
@@ -64,11 +64,26 @@ class PermissionObjectLink implements PermissionObject {
|
||||
return master.hasPermission(node, b, checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull String node, @NonNull boolean b, @NonNull String server, @NonNull String world) {
|
||||
return master.hasPermission(node, b, checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull String node, @NonNull boolean b, @NonNull boolean temporary) {
|
||||
return master.hasPermission(node, b, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull String node, @NonNull boolean b, @NonNull String server, @NonNull boolean temporary) {
|
||||
return master.hasPermission(node, b, checkServer(server), temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull String node, @NonNull boolean b, @NonNull String server, @NonNull String world, @NonNull boolean temporary) {
|
||||
return master.hasPermission(node, b, checkServer(server), world, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsPermission(@NonNull String node, @NonNull boolean b) {
|
||||
return master.inheritsPermission(node, b);
|
||||
@@ -79,11 +94,26 @@ class PermissionObjectLink implements PermissionObject {
|
||||
return master.inheritsPermission(node, b, checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsPermission(@NonNull String node, @NonNull boolean b, @NonNull String server, @NonNull String world) {
|
||||
return master.inheritsPermission(node, b, checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsPermission(@NonNull String node, @NonNull boolean b, @NonNull boolean temporary) {
|
||||
return master.inheritsPermission(node, b, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsPermission(@NonNull String node, @NonNull boolean b, @NonNull String server, @NonNull boolean temporary) {
|
||||
return master.inheritsPermission(node, b, checkServer(server), temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inheritsPermission(@NonNull String node, @NonNull boolean b, @NonNull String server, @NonNull String world, @NonNull boolean temporary) {
|
||||
return master.inheritsPermission(node, b, checkServer(server), world, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermission(@NonNull String node, @NonNull boolean value) throws ObjectAlreadyHasException {
|
||||
master.setPermission(checkNode(node), value);
|
||||
@@ -94,6 +124,11 @@ class PermissionObjectLink implements PermissionObject {
|
||||
master.setPermission(checkNode(node), value, checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermission(@NonNull String node, @NonNull boolean value, @NonNull String server, @NonNull String world) throws ObjectAlreadyHasException {
|
||||
master.setPermission(checkNode(node), value, checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermission(@NonNull String node, @NonNull boolean value, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
master.setPermission(checkNode(node), value, checkTime(expireAt));
|
||||
@@ -104,6 +139,11 @@ class PermissionObjectLink implements PermissionObject {
|
||||
master.setPermission(checkNode(node), value, checkServer(server), checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermission(@NonNull String node, @NonNull boolean value, @NonNull String server, @NonNull String world, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
master.setPermission(checkNode(node), value, checkServer(server), world, checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetPermission(@NonNull String node, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
master.unsetPermission(checkNode(node), temporary);
|
||||
@@ -119,11 +159,26 @@ class PermissionObjectLink implements PermissionObject {
|
||||
master.unsetPermission(checkNode(node), checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetPermission(@NonNull String node, @NonNull String server, @NonNull String world) throws ObjectLacksException {
|
||||
master.unsetPermission(checkNode(node), checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetPermission(@NonNull String node, @NonNull String server, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
master.unsetPermission(checkNode(node), checkServer(server), temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetPermission(@NonNull String node, @NonNull String server, @NonNull String world, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
master.unsetPermission(checkNode(node), checkServer(server), world, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups) {
|
||||
return master.getLocalPermissions(server, world, excludedGroups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups) {
|
||||
return master.getLocalPermissions(server, excludedGroups);
|
||||
|
||||
@@ -70,6 +70,12 @@ public class UserLink extends PermissionObjectLink implements User {
|
||||
return master.isInGroup(((GroupLink) group).getMaster(), server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInGroup(@NonNull Group group, @NonNull String server, @NonNull String world) {
|
||||
Utils.checkGroup(group);
|
||||
return master.isInGroup(((GroupLink) group).getMaster(), server, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(@NonNull Group group) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
@@ -82,6 +88,12 @@ public class UserLink extends PermissionObjectLink implements User {
|
||||
master.addGroup(((GroupLink) group).getMaster(), checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(@NonNull Group group, @NonNull String server, @NonNull String world) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.addGroup(((GroupLink) group).getMaster(), checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(@NonNull Group group, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
@@ -94,6 +106,12 @@ public class UserLink extends PermissionObjectLink implements User {
|
||||
master.addGroup(((GroupLink) group).getMaster(), checkServer(server), checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(@NonNull Group group, @NonNull String server, @NonNull String world, @NonNull long expireAt) throws ObjectAlreadyHasException {
|
||||
Utils.checkGroup(group);
|
||||
master.addGroup(((GroupLink) group).getMaster(), checkServer(server), world, checkTime(expireAt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(@NonNull Group group) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
@@ -112,12 +130,24 @@ public class UserLink extends PermissionObjectLink implements User {
|
||||
master.removeGroup(((GroupLink) group).getMaster(), checkServer(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(@NonNull Group group, @NonNull String server, @NonNull String world) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.removeGroup(((GroupLink) group).getMaster(), checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(@NonNull Group group, @NonNull String server, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.removeGroup(((GroupLink) group).getMaster(), checkServer(server), temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(@NonNull Group group, @NonNull String server, @NonNull String world, @NonNull boolean temporary) throws ObjectLacksException {
|
||||
Utils.checkGroup(group);
|
||||
master.removeGroup(((GroupLink) group).getMaster(), checkServer(server), world, temporary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearNodes() {
|
||||
master.clearNodes();
|
||||
@@ -128,6 +158,11 @@ public class UserLink extends PermissionObjectLink implements User {
|
||||
return master.getGroupNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLocalGroups(@NonNull String server, @NonNull String world) {
|
||||
return master.getLocalGroups(checkServer(server), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLocalGroups(@NonNull String server) {
|
||||
return master.getLocalGroups(checkServer(server));
|
||||
|
||||
+9
-4
@@ -14,18 +14,23 @@ import java.util.List;
|
||||
public class GroupHasPerm extends GroupSubCommand {
|
||||
public GroupHasPerm() {
|
||||
super("haspermission", "Checks to see if a group has a certain permission node",
|
||||
"/%s group <group> haspermission <node> [server]", Permission.GROUP_HASPERMISSION);
|
||||
"/%s group <group> haspermission <node> [server] [world]", Permission.GROUP_HASPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(args.get(1)).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, args.get(1).toLowerCase()));
|
||||
if (args.size() == 2) {
|
||||
Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, args.get(1)));
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, args.get(1), args.get(2)));
|
||||
}
|
||||
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), group.hasPermission(args.get(0), true, "global"));
|
||||
}
|
||||
@@ -33,6 +38,6 @@ public class GroupHasPerm extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+9
-4
@@ -14,18 +14,23 @@ import java.util.List;
|
||||
public class GroupInheritsPerm extends GroupSubCommand {
|
||||
public GroupInheritsPerm() {
|
||||
super("inheritspermission", "Checks to see if a group inherits a certain permission node",
|
||||
"/%s group <group> inheritspermission <node> [server]", Permission.GROUP_INHERITSPERMISSION);
|
||||
"/%s group <group> inheritspermission <node> [server] [world]", Permission.GROUP_INHERITSPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(args.get(1)).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true, args.get(1).toLowerCase()));
|
||||
if (args.size() == 2) {
|
||||
Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true, args.get(1)));
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true, args.get(1), args.get(2)));
|
||||
}
|
||||
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), group.inheritsPermission(args.get(0), true));
|
||||
}
|
||||
@@ -33,6 +38,6 @@ public class GroupInheritsPerm extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class GroupSetInherit extends GroupSubCommand {
|
||||
public GroupSetInherit() {
|
||||
super("setinherit", "Sets another group for this group to inherit permissions from",
|
||||
"/%s group <group> setinherit <group> [server]", Permission.GROUP_SETINHERIT);
|
||||
"/%s group <group> setinherit <group> [server] [world]", Permission.GROUP_SETINHERIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,15 +31,22 @@ public class GroupSetInherit extends GroupSubCommand {
|
||||
Message.GROUP_LOAD_ERROR.send(sender);
|
||||
} else {
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.setPermission("group." + groupName, true, server);
|
||||
Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
if (args.size() == 2) {
|
||||
group.setPermission("group." + groupName, true, server);
|
||||
Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.setPermission("group." + groupName, true, server, world);
|
||||
Message.GROUP_SETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
group.setPermission("group." + groupName, true);
|
||||
Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
@@ -60,6 +67,6 @@ public class GroupSetInherit extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
public class GroupSetPermission extends GroupSubCommand {
|
||||
public GroupSetPermission() {
|
||||
super("set", "Sets a permission for a group", "/%s group <group> set <node> <true|false> [server]",
|
||||
super("set", "Sets a permission for a group", "/%s group <group> set <node> <true|false> [server] [world]",
|
||||
Permission.GROUP_SETPERMISSION);
|
||||
}
|
||||
|
||||
@@ -40,15 +40,22 @@ public class GroupSetPermission extends GroupSubCommand {
|
||||
boolean b = Boolean.parseBoolean(bool);
|
||||
|
||||
try {
|
||||
if (args.size() == 3) {
|
||||
if (args.size() >= 3) {
|
||||
final String server = args.get(2).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.setPermission(node, b, server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server);
|
||||
if (args.size() == 3) {
|
||||
group.setPermission(node, b, server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.setPermission(node, b, server, world);
|
||||
Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
group.setPermission(node, b);
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getName());
|
||||
@@ -67,6 +74,6 @@ public class GroupSetPermission extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 2 && argLength != 3;
|
||||
return argLength != 2 && argLength != 3 && argLength != 4;
|
||||
}
|
||||
}
|
||||
+14
-6
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class GroupSetTempInherit extends GroupSubCommand {
|
||||
public GroupSetTempInherit() {
|
||||
super("settempinherit", "Sets another group for this group to inherit permissions from temporarily",
|
||||
"/%s group <group> settempinherit <group> <duration> [server]", Permission.GROUP_SET_TEMP_INHERIT);
|
||||
"/%s group <group> settempinherit <group> <duration> [server] [world]", Permission.GROUP_SET_TEMP_INHERIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,16 +45,24 @@ public class GroupSetTempInherit extends GroupSubCommand {
|
||||
Message.GROUP_LOAD_ERROR.send(sender);
|
||||
} else {
|
||||
try {
|
||||
if (args.size() == 3) {
|
||||
if (args.size() >= 3) {
|
||||
final String server = args.get(2).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.setPermission("group." + groupName, true, server, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
if (args.size() == 3) {
|
||||
group.setPermission("group." + groupName, true, server, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
group.setPermission("group." + groupName, true, server, world, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server,
|
||||
world, DateUtil.formatDateDiff(duration));
|
||||
}
|
||||
|
||||
} else {
|
||||
group.setPermission("group." + groupName, true, duration);
|
||||
Message.GROUP_SET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), groupName, DateUtil.formatDateDiff(duration));
|
||||
@@ -75,6 +83,6 @@ public class GroupSetTempInherit extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 2 && argLength != 3;
|
||||
return argLength != 2 && argLength != 3 && argLength != 4;
|
||||
}
|
||||
}
|
||||
+15
-6
@@ -14,8 +14,8 @@ import java.util.List;
|
||||
|
||||
public class GroupSetTempPermission extends GroupSubCommand {
|
||||
public GroupSetTempPermission() {
|
||||
super("settemp", "Sets a temporary permission for a group", "/%s group <group> settemp <node> <true|false> <duration> [server]",
|
||||
Permission.GROUP_SET_TEMP_PERMISSION);
|
||||
super("settemp", "Sets a temporary permission for a group",
|
||||
"/%s group <group> settemp <node> <true|false> <duration> [server] [world]", Permission.GROUP_SET_TEMP_PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,15 +54,24 @@ public class GroupSetTempPermission extends GroupSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 4) {
|
||||
if (args.size() >= 4) {
|
||||
final String server = args.get(3).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.setPermission(node, b, server, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server, DateUtil.formatDateDiff(duration));
|
||||
if (args.size() == 4) {
|
||||
group.setPermission(node, b, server, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
} else {
|
||||
final String world = args.get(4).toLowerCase();
|
||||
group.setPermission(node, b, server, world, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server,
|
||||
world, DateUtil.formatDateDiff(duration));
|
||||
}
|
||||
|
||||
} else {
|
||||
group.setPermission(node, b, duration);
|
||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, group.getName(), DateUtil.formatDateDiff(duration));
|
||||
@@ -81,6 +90,6 @@ public class GroupSetTempPermission extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 3 && argLength != 4;
|
||||
return argLength != 3 && argLength != 4 && argLength != 5;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class GroupUnSetPermission extends GroupSubCommand {
|
||||
public GroupUnSetPermission() {
|
||||
super("unset", "Unsets a permission for a group",
|
||||
"/%s group <group> unset <node> [server]", Permission.GROUP_UNSETPERMISSION);
|
||||
"/%s group <group> unset <node> [server] [world]", Permission.GROUP_UNSETPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +32,22 @@ public class GroupUnSetPermission extends GroupSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.unsetPermission(node, server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission(node, server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission(node, server, world);
|
||||
Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node);
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getName());
|
||||
@@ -54,6 +61,6 @@ public class GroupUnSetPermission extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class GroupUnsetInherit extends GroupSubCommand {
|
||||
public GroupUnsetInherit() {
|
||||
super("unsetinherit", "Unsets another group for this group to inherit permissions from",
|
||||
"/%s group <group> unsetinherit <group> [server]", Permission.GROUP_UNSETINHERIT);
|
||||
"/%s group <group> unsetinherit <group> [server] [world]", Permission.GROUP_UNSETINHERIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -27,15 +27,22 @@ public class GroupUnsetInherit extends GroupSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.unsetPermission("group." + groupName, server);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission("group." + groupName, server);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission("group." + groupName, server, world);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
group.unsetPermission("group." + groupName);
|
||||
Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
@@ -54,6 +61,6 @@ public class GroupUnsetInherit extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class GroupUnsetTempInherit extends GroupSubCommand {
|
||||
public GroupUnsetTempInherit() {
|
||||
super("unsettempinherit", "Unsets another group for this group to inherit permissions from",
|
||||
"/%s group <group> unsettempinherit <group> [server]", Permission.GROUP_UNSET_TEMP_INHERIT);
|
||||
"/%s group <group> unsettempinherit <group> [server] [world]", Permission.GROUP_UNSET_TEMP_INHERIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -27,15 +27,22 @@ public class GroupUnsetTempInherit extends GroupSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.unsetPermission("group." + groupName, server, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission("group." + groupName, server, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission("group." + groupName, server, world, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
group.unsetPermission("group." + groupName, true);
|
||||
Message.GROUP_UNSET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
@@ -54,6 +61,6 @@ public class GroupUnsetTempInherit extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class GroupUnsetTempPermission extends GroupSubCommand {
|
||||
public GroupUnsetTempPermission() {
|
||||
super("unsettemp", "Unsets a temporary permission for a group",
|
||||
"/%s group <group> unsettemp <node> [server]", Permission.GROUP_UNSET_TEMP_PERMISSION);
|
||||
"/%s group <group> unsettemp <node> [server] [world]", Permission.GROUP_UNSET_TEMP_PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +32,22 @@ public class GroupUnsetTempPermission extends GroupSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
group.unsetPermission(node, server);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server, true);
|
||||
if (args.size() == 2) {
|
||||
group.unsetPermission(node, server);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
group.unsetPermission(node, server, world);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
group.unsetPermission(node, true);
|
||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, group.getName());
|
||||
@@ -54,6 +61,6 @@ public class GroupUnsetTempPermission extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class InfoCommand extends MainCommand {
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) {
|
||||
final LPConfiguration c = plugin.getConfiguration();
|
||||
Message.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName(), c.getServer(),
|
||||
c.getDefaultGroupName(), c.getSyncTime(), c.getIncludeGlobalPerms());
|
||||
c.getDefaultGroupName(), c.getSyncTime(), c.getIncludeGlobalPerms(), c.getOnlineMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
public class UserAddGroup extends UserSubCommand {
|
||||
public UserAddGroup() {
|
||||
super("addgroup", "Adds the user to a group", "/%s user <user> addgroup <group> [server]", Permission.USER_ADDGROUP);
|
||||
super("addgroup", "Adds the user to a group", "/%s user <user> addgroup <group> [server] [world]", Permission.USER_ADDGROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,15 +37,22 @@ public class UserAddGroup extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.addGroup(group, server);
|
||||
Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
if (args.size() == 2) {
|
||||
user.addGroup(group, server);
|
||||
Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
user.addGroup(group, server, world);
|
||||
Message.USER_ADDGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
user.addGroup(group);
|
||||
Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
@@ -66,6 +73,6 @@ public class UserAddGroup extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return (argLength != 1 && argLength != 2);
|
||||
return (argLength != 1 && argLength != 2 && argLength != 3);
|
||||
}
|
||||
}
|
||||
+15
-7
@@ -15,8 +15,8 @@ import java.util.List;
|
||||
|
||||
public class UserAddTempGroup extends UserSubCommand {
|
||||
public UserAddTempGroup() {
|
||||
super("addtempgroup", "Adds the user to a group temporarily", "/%s user <user> addtempgroup <group> <duration> [server]",
|
||||
Permission.USER_ADDTEMPGROUP);
|
||||
super("addtempgroup", "Adds the user to a group temporarily",
|
||||
"/%s user <user> addtempgroup <group> <duration> [server] [world]", Permission.USER_ADDTEMPGROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,16 +52,24 @@ public class UserAddTempGroup extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 3) {
|
||||
if (args.size() >= 3) {
|
||||
final String server = args.get(2).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.addGroup(group, server, duration);
|
||||
Message.USER_ADDTEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
if (args.size() == 3) {
|
||||
user.addGroup(group, server, duration);
|
||||
Message.USER_ADDTEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server,
|
||||
DateUtil.formatDateDiff(duration));
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
user.addGroup(group, server, world, duration);
|
||||
Message.USER_ADDTEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server,
|
||||
world, DateUtil.formatDateDiff(duration));
|
||||
}
|
||||
|
||||
} else {
|
||||
user.addGroup(group, duration);
|
||||
Message.USER_ADDTEMPGROUP_SUCCESS.send(sender, user.getName(), groupName, DateUtil.formatDateDiff(duration));
|
||||
@@ -82,6 +90,6 @@ public class UserAddTempGroup extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return (argLength != 2 && argLength != 3);
|
||||
return (argLength != 2 && argLength != 3 && argLength != 4);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class UserHasPerm extends UserSubCommand {
|
||||
public UserHasPerm() {
|
||||
super("haspermission", "Checks to see if a user has a certain permission node",
|
||||
"/%s user <user> haspermission <node> [server]", Permission.USER_HASPERMISSION);
|
||||
"/%s user <user> haspermission <node> [server] [world]", Permission.USER_HASPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,7 +25,12 @@ public class UserHasPerm extends UserSubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, args.get(1)));
|
||||
if (args.size() == 2) {
|
||||
Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, args.get(1)));
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, args.get(1), args.get(2)));
|
||||
}
|
||||
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), user.hasPermission(args.get(0), true, "global"));
|
||||
}
|
||||
@@ -33,6 +38,6 @@ public class UserHasPerm extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+8
-3
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class UserInheritsPerm extends UserSubCommand {
|
||||
public UserInheritsPerm() {
|
||||
super("inheritspermission", "Checks to see if a user inherits a certain permission node",
|
||||
"/%s user <user> inheritspermission <node> [server]", Permission.USER_INHERITSPERMISSION);
|
||||
"/%s user <user> inheritspermission <node> [server] [world]", Permission.USER_INHERITSPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,7 +25,12 @@ public class UserInheritsPerm extends UserSubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true, args.get(1)));
|
||||
if (args.size() == 2) {
|
||||
Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true, args.get(1)));
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true, args.get(1), args.get(2)));
|
||||
}
|
||||
|
||||
} else {
|
||||
Util.sendBoolean(sender, args.get(0), user.inheritsPermission(args.get(0), true));
|
||||
}
|
||||
@@ -33,6 +38,6 @@ public class UserInheritsPerm extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
public class UserRemoveGroup extends UserSubCommand {
|
||||
public UserRemoveGroup() {
|
||||
super("removegroup", "Removes a user from a group", "/%s user <user> removegroup <group> [server]", Permission.USER_REMOVEGROUP);
|
||||
super("removegroup", "Removes a user from a group", "/%s user <user> removegroup <group> [server] [world]", Permission.USER_REMOVEGROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +32,22 @@ public class UserRemoveGroup extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.unsetPermission("group." + groupName, server);
|
||||
Message.USER_REMOVEGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
if (args.size() == 2) {
|
||||
user.unsetPermission("group." + groupName, server);
|
||||
Message.USER_REMOVEGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
user.unsetPermission("group." + groupName, server, world);
|
||||
Message.USER_REMOVEGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
user.unsetPermission("group." + groupName);
|
||||
Message.USER_REMOVEGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
@@ -59,6 +66,6 @@ public class UserRemoveGroup extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return (argLength != 1 && argLength != 2);
|
||||
return (argLength != 1 && argLength != 2 && argLength != 3);
|
||||
}
|
||||
}
|
||||
+13
-5
@@ -13,7 +13,8 @@ import java.util.List;
|
||||
|
||||
public class UserRemoveTempGroup extends UserSubCommand {
|
||||
public UserRemoveTempGroup() {
|
||||
super("removetempgroup", "Removes a user from a temporary group", "/%s user <user> removetempgroup <group> [server]", Permission.USER_REMOVETEMPGROUP);
|
||||
super("removetempgroup", "Removes a user from a temporary group",
|
||||
"/%s user <user> removetempgroup <group> [server] [world]", Permission.USER_REMOVETEMPGROUP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,15 +27,22 @@ public class UserRemoveTempGroup extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.unsetPermission("group." + groupName, server, true);
|
||||
Message.USER_REMOVETEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
if (args.size() == 2) {
|
||||
user.unsetPermission("group." + groupName, server, true);
|
||||
Message.USER_REMOVETEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
user.unsetPermission("group." + groupName, server, world, true);
|
||||
Message.USER_REMOVETEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
user.unsetPermission("group." + groupName, true);
|
||||
Message.USER_REMOVETEMPGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
@@ -53,6 +61,6 @@ public class UserRemoveTempGroup extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return (argLength != 1 && argLength != 2);
|
||||
return (argLength != 1 && argLength != 2 && argLength != 3);
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class UserSetPermission extends UserSubCommand {
|
||||
public UserSetPermission() {
|
||||
super("set", "Sets a permission for a user",
|
||||
"/%s user <user> set <node> <true|false> [server]", Permission.USER_SETPERMISSION);
|
||||
"/%s user <user> set <node> <true|false> [server] [world]", Permission.USER_SETPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,15 +40,22 @@ public class UserSetPermission extends UserSubCommand {
|
||||
boolean b = Boolean.parseBoolean(bool);
|
||||
|
||||
try {
|
||||
if (args.size() == 3) {
|
||||
if (args.size() >= 3) {
|
||||
final String server = args.get(2).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.setPermission(node, b, server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server);
|
||||
if (args.size() == 3) {
|
||||
user.setPermission(node, b, server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server);
|
||||
} else {
|
||||
final String world = args.get(3).toLowerCase();
|
||||
user.setPermission(node, b, server, world);
|
||||
Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, user.getName(), server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
user.setPermission(node, b);
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, bool, user.getName());
|
||||
@@ -67,6 +74,6 @@ public class UserSetPermission extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 2 && argLength != 3;
|
||||
return argLength != 2 && argLength != 3 && argLength != 4;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
public class UserSetTempPermission extends UserSubCommand {
|
||||
public UserSetTempPermission() {
|
||||
super("settemp", "Sets a temporary permission for a user",
|
||||
"/%s user <user> settemp <node> <true|false> <duration> [server]", Permission.USER_SET_TEMP_PERMISSION);
|
||||
"/%s user <user> settemp <node> <true|false> <duration> [server] [world]", Permission.USER_SET_TEMP_PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,15 +54,22 @@ public class UserSetTempPermission extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 4) {
|
||||
if (args.size() >= 4) {
|
||||
final String server = args.get(3).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.setPermission(node, b, server, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server, DateUtil.formatDateDiff(duration));
|
||||
if (args.size() == 4) {
|
||||
user.setPermission(node, b, server, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server, DateUtil.formatDateDiff(duration));
|
||||
} else {
|
||||
final String world = args.get(4).toLowerCase();
|
||||
user.setPermission(node, b, server, world, duration);
|
||||
Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, user.getName(), server, world, DateUtil.formatDateDiff(duration));
|
||||
}
|
||||
|
||||
} else {
|
||||
user.setPermission(node, b, duration);
|
||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, user.getName(), DateUtil.formatDateDiff(duration));
|
||||
@@ -81,6 +88,6 @@ public class UserSetTempPermission extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 3 && argLength != 4;
|
||||
return argLength != 3 && argLength != 4 && argLength != 5;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class UserUnSetPermission extends UserSubCommand {
|
||||
public UserUnSetPermission() {
|
||||
super("unset", "Unsets a permission for a user",
|
||||
"/%s user <user> unset <node> [server]", Permission.USER_UNSETPERMISSION);
|
||||
"/%s user <user> unset <node> [server] [world]", Permission.USER_UNSETPERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +32,22 @@ public class UserUnSetPermission extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.unsetPermission(node, server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server);
|
||||
if (args.size() == 2) {
|
||||
user.unsetPermission(node, server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
user.unsetPermission(node, server, world);
|
||||
Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, user.getName(), server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
user.unsetPermission(node);
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, user.getName());
|
||||
@@ -54,6 +61,6 @@ public class UserUnSetPermission extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
+12
-5
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class UserUnsetTempPermission extends UserSubCommand {
|
||||
public UserUnsetTempPermission() {
|
||||
super("unsettemp", "Unsets a temporary permission for a user",
|
||||
"/%s user <user> unsettemp <node> [server]", Permission.USER_UNSET_TEMP_PERMISSION);
|
||||
"/%s user <user> unsettemp <node> [server] [world]", Permission.USER_UNSET_TEMP_PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,15 +32,22 @@ public class UserUnsetTempPermission extends UserSubCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() >= 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
if (Patterns.NON_ALPHA_NUMERIC.matcher(server).find()) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.unsetPermission(node, server, true);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server);
|
||||
if (args.size() == 2) {
|
||||
user.unsetPermission(node, server, true);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server);
|
||||
} else {
|
||||
final String world = args.get(2).toLowerCase();
|
||||
user.unsetPermission(node, server, world, true);
|
||||
Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, user.getName(), server, world);
|
||||
}
|
||||
|
||||
} else {
|
||||
user.unsetPermission(node, true);
|
||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, user.getName());
|
||||
@@ -54,6 +61,6 @@ public class UserUnsetTempPermission extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
public boolean isArgLengthInvalid(int argLength) {
|
||||
return argLength != 1 && argLength != 2;
|
||||
return argLength != 1 && argLength != 2 && argLength != 3;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
package me.lucko.luckperms.constants;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
@AllArgsConstructor
|
||||
public enum Message {
|
||||
|
||||
/**
|
||||
@@ -99,7 +97,8 @@ public enum Message {
|
||||
PREFIX + "&eServer Name: &6%s" + "\n" +
|
||||
PREFIX + "&eDefault Group: &6%s" + "\n" +
|
||||
PREFIX + "&eSync Interval: &6%s minutes" + "\n" +
|
||||
PREFIX + "&eInclude Global Perms: &6%s",
|
||||
PREFIX + "&eInclude Global Perms: &6%s" + "\n" +
|
||||
PREFIX + "&eOnline Mode: &6%s",
|
||||
false
|
||||
),
|
||||
DEBUG(
|
||||
@@ -124,12 +123,16 @@ public enum Message {
|
||||
LISTNODES_TEMP("&e%s's Temporary Nodes:" + "\n" + "%s", true),
|
||||
SETPERMISSION_SUCCESS("&aSet &b%s&a to &b%s&a for &b%s&a.", true),
|
||||
SETPERMISSION_SERVER_SUCCESS("&aSet &b%s&a to &b%s&a for &b%s&a on server &b%s&a.", true),
|
||||
SETPERMISSION_SERVER_WORLD_SUCCESS("&aSet &b%s&a to &b%s&a for &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
SETPERMISSION_TEMP_SUCCESS("&aSet &b%s&a to &b%s&a for &b%s&a for a duration of &b%s&a.", true),
|
||||
SETPERMISSION_TEMP_SERVER_SUCCESS("&aSet &b%s&a to &b%s&a for &b%s&a on server &b%s&a for a duration of &b%s&a.", true),
|
||||
SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS("&aSet &b%s&a to &b%s&a for &b%s&a on server &b%s&a, world &b%s&a, for a duration of &b%s&a.", true),
|
||||
UNSETPERMISSION_SUCCESS("&aUnset &b%s&a for &b%s&a.", true),
|
||||
UNSETPERMISSION_SERVER_SUCCESS("&aUnset &b%s&a for &b%s&a on server &b%$s&a.", true),
|
||||
UNSETPERMISSION_SERVER_WORLD_SUCCESS("&aUnset &b%s&a for &b%s&a on server &b%$s&a, world &b%$s&a.", true),
|
||||
UNSET_TEMP_PERMISSION_SUCCESS("&aUnset temporary permission &b%s&a for &b%s&a.", true),
|
||||
UNSET_TEMP_PERMISSION_SERVER_SUCCESS("&aUnset temporary permission &b%s&a for &b%s&a on server &b%$s&a.", true),
|
||||
UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS("&aUnset temporary permission &b%s&a for &b%s&a on server &b%$s&a, world &b%$s&a.", true),
|
||||
CLEAR_SUCCESS("&b%s&a's permissions were cleared.", true),
|
||||
ILLEGAL_DATE_ERROR("Could not parse date '%s'.", true),
|
||||
PAST_DATE_ERROR("You cannot set a date in the past!", true),
|
||||
@@ -148,12 +151,16 @@ public enum Message {
|
||||
USER_GETUUID("&bThe UUID of &e%s&b is &e%s&b.", true),
|
||||
USER_ADDGROUP_SUCCESS("&b%s&a successfully added to group &b%s&a.", true),
|
||||
USER_ADDGROUP_SERVER_SUCCESS("&b%s&a successfully added to group &b%s&a on server &b%s&a.", true),
|
||||
USER_ADDGROUP_SERVER_WORLD_SUCCESS("&b%s&a successfully added to group &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
USER_ADDTEMPGROUP_SUCCESS("&b%s&a successfully added to group &b%s&a for a duration of &b%s&a.", true),
|
||||
USER_ADDTEMPGROUP_SERVER_SUCCESS("&b%s&a successfully added to group &b%s&a on server &b%s&a for a duration of &b%s&a.", true),
|
||||
USER_ADDTEMPGROUP_SERVER_WORLD_SUCCESS("&b%s&a successfully added to group &b%s&a on server &b%s&a, world &b%s&a, for a duration of &b%s&a.", true),
|
||||
USER_REMOVEGROUP_SUCCESS("&b%s&a was removed from group &b%s&a.", true),
|
||||
USER_REMOVEGROUP_SERVER_SUCCESS("&b%s&a was removed from group &b%s&a on server &b%s&a.", true),
|
||||
USER_REMOVEGROUP_SERVER_WORLD_SUCCESS("&b%s&a was removed from group &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
USER_REMOVETEMPGROUP_SUCCESS("&b%s&a was removed from temproary group &b%s&a.", true),
|
||||
USER_REMOVETEMPGROUP_SERVER_SUCCESS("&b%s&a was removed from temporary group &b%s&a on server &b%s&a.", true),
|
||||
USER_REMOVETEMPGROUP_SERVER_WORLD_SUCCESS("&b%s&a was removed from temporary group &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
USER_REMOVEGROUP_ERROR_PRIMARY("You cannot remove a user from their primary group.", true),
|
||||
USER_PRIMARYGROUP_SUCCESS("&b%s&a's primary group was set to &b%s&a.", true),
|
||||
USER_PRIMARYGROUP_ERROR_ALREADYHAS("The user already has this group set as their primary group.", true),
|
||||
@@ -188,12 +195,16 @@ public enum Message {
|
||||
),
|
||||
GROUP_SETINHERIT_SUCCESS("&b%s&a now inherits permissions from &b%s&a.", true),
|
||||
GROUP_SETINHERIT_SERVER_SUCCESS("&b%s&a now inherits permissions from &b%s&a on server &b%s&a.", true),
|
||||
GROUP_SETINHERIT_SERVER_WORLD_SUCCESS("&b%s&a now inherits permissions from &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
GROUP_SET_TEMP_INHERIT_SUCCESS("&b%s&a now inherits permissions from &b%s&a for a duration of &b%s&a.", true),
|
||||
GROUP_SET_TEMP_INHERIT_SERVER_SUCCESS("&b%s&a now inherits permissions from &b%s&a on server &b%s&a for a duration of &b%s&a.", true),
|
||||
GROUP_SET_TEMP_INHERIT_SERVER_WORLD_SUCCESS("&b%s&a now inherits permissions from &b%s&a on server &b%s&a, world &b%s&a, for a duration of &b%s&a.", true),
|
||||
GROUP_UNSETINHERIT_SUCCESS("&b%s&a no longer inherits permissions from &b%s&a.", true),
|
||||
GROUP_UNSETINHERIT_SERVER_SUCCESS("&b%s&a no longer inherits permissions from &b%s&a on server &b%s&a.", true),
|
||||
GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS("&b%s&a no longer inherits permissions from &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
GROUP_UNSET_TEMP_INHERIT_SUCCESS("&b%s&a no longer temporarily inherits permissions from &b%s&a.", true),
|
||||
GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS("&b%s&a no longer temporarily inherits permissions from &b%s&a on server &b%s&a.", true),
|
||||
GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS("&b%s&a no longer temporarily inherits permissions from &b%s&a on server &b%s&a, world &b%s&a.", true),
|
||||
|
||||
TRACK_INFO(
|
||||
PREFIX + "&d-> &eTrack: &6%s" + "\n" +
|
||||
@@ -210,6 +221,11 @@ public enum Message {
|
||||
private String message;
|
||||
private boolean showPrefix;
|
||||
|
||||
Message(String message, boolean showPrefix) {
|
||||
this.message = Util.color(message);
|
||||
this.showPrefix = showPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return message;
|
||||
@@ -217,9 +233,9 @@ public enum Message {
|
||||
|
||||
public void send(Sender sender, Object... objects) {
|
||||
if (showPrefix) {
|
||||
sender.sendMessage(Util.color(PREFIX + String.format(message, objects)));
|
||||
sender.sendMessage(PREFIX + String.format(message, objects));
|
||||
} else {
|
||||
sender.sendMessage(Util.color(String.format(message, objects)));
|
||||
sender.sendMessage(String.format(message, objects));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,12 +39,8 @@ public abstract class Datastore {
|
||||
plugin.doSync(r);
|
||||
}
|
||||
|
||||
private void runCallback(boolean result, Callback callback) {
|
||||
doSync(() -> callback.onComplete(result));
|
||||
}
|
||||
|
||||
private void runCallback(UUID result, Callback.GetUUID callback) {
|
||||
doSync(() -> callback.onComplete(result));
|
||||
private <T> void runCallback(T t, Callback<T> callback) {
|
||||
doSync(() -> callback.onComplete(t));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -74,63 +70,63 @@ public abstract class Datastore {
|
||||
These methods will schedule the operation to run async. The callback will be ran when the task is complete.
|
||||
Callbacks are ran on the main Bukkit server thread (if applicable)
|
||||
*/
|
||||
public void loadOrCreateUser(UUID uuid, String username, Callback callback) {
|
||||
public void loadOrCreateUser(UUID uuid, String username, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(loadOrCreateUser(uuid, username), callback));
|
||||
}
|
||||
|
||||
public void loadUser(UUID uuid, Callback callback) {
|
||||
public void loadUser(UUID uuid, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(loadUser(uuid), callback));
|
||||
}
|
||||
|
||||
public void saveUser(User user, Callback callback) {
|
||||
public void saveUser(User user, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(saveUser(user), callback));
|
||||
}
|
||||
|
||||
public void createAndLoadGroup(String name, Callback callback) {
|
||||
public void createAndLoadGroup(String name, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(createAndLoadGroup(name), callback));
|
||||
}
|
||||
|
||||
public void loadGroup(String name, Callback callback) {
|
||||
public void loadGroup(String name, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(loadGroup(name), callback));
|
||||
}
|
||||
|
||||
public void loadAllGroups(Callback callback) {
|
||||
public void loadAllGroups(Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(loadAllGroups(), callback));
|
||||
}
|
||||
|
||||
public void saveGroup(Group group, Callback callback) {
|
||||
public void saveGroup(Group group, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(saveGroup(group), callback));
|
||||
}
|
||||
|
||||
public void deleteGroup(Group group, Callback callback) {
|
||||
public void deleteGroup(Group group, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(deleteGroup(group), callback));
|
||||
}
|
||||
|
||||
public void createAndLoadTrack(String name, Callback callback) {
|
||||
public void createAndLoadTrack(String name, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(createAndLoadTrack(name), callback));
|
||||
}
|
||||
|
||||
public void loadTrack(String name, Callback callback) {
|
||||
public void loadTrack(String name, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(loadTrack(name), callback));
|
||||
}
|
||||
|
||||
public void loadAllTracks(Callback callback) {
|
||||
public void loadAllTracks(Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(loadAllTracks(), callback));
|
||||
}
|
||||
|
||||
public void saveTrack(Track track, Callback callback) {
|
||||
public void saveTrack(Track track, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(saveTrack(track), callback));
|
||||
}
|
||||
|
||||
public void deleteTrack(Track track, Callback callback) {
|
||||
public void deleteTrack(Track track, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(deleteTrack(track), callback));
|
||||
}
|
||||
|
||||
public void saveUUIDData(String username, UUID uuid, Callback callback) {
|
||||
public void saveUUIDData(String username, UUID uuid, Callback<Boolean> callback) {
|
||||
doAsync(() -> runCallback(saveUUIDData(username, uuid), callback));
|
||||
}
|
||||
|
||||
public void getUUID(String username, Callback.GetUUID callback) {
|
||||
public void getUUID(String username, Callback<UUID> callback) {
|
||||
doAsync(() -> runCallback(getUUID(username), callback));
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,15 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.utils.Patterns;
|
||||
import me.lucko.luckperms.utils.PermissionObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ToString(of = {"name"})
|
||||
@EqualsAndHashCode(of = {"name"}, callSuper = false)
|
||||
public class Group extends PermissionObject {
|
||||
@@ -21,10 +28,241 @@ public class Group extends PermissionObject {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* check to see if a group inherits a group
|
||||
* @param group The group to check membership of
|
||||
* @return true if the user is a member of the group
|
||||
*/
|
||||
public boolean inheritsGroup(Group group) {
|
||||
return inheritsGroup(group, "global");
|
||||
}
|
||||
|
||||
/**
|
||||
* check to see if the group inherits a group on a specific server
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @return true if the group inherits the group
|
||||
*/
|
||||
public boolean inheritsGroup(Group group, String server) {
|
||||
return hasPermission("group." + group.getName(), true, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* check to see if the group inherits a group on a specific server
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @return true if the group inherits the group
|
||||
*/
|
||||
public boolean inheritsGroup(Group group, String server, String world) {
|
||||
return hasPermission("group." + group.getName(), true, server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this group inherit another group
|
||||
* @param group the group to be inherited
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group
|
||||
*/
|
||||
public void setInheritGroup(Group group) throws ObjectAlreadyHasException {
|
||||
setInheritGroup(group, "global");
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
public void setInheritGroup(Group group, String server) throws ObjectAlreadyHasException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
setPermission("group." + group.getName(), true, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
public void setInheritGroup(Group group, String server, String world) throws ObjectAlreadyHasException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
setPermission("group." + group.getName(), true, server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
public void setInheritGroup(Group group, long expireAt) throws ObjectAlreadyHasException {
|
||||
setPermission("group." + group.getName(), true, expireAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
public void setInheritGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
setPermission("group." + group.getName(), true, server, expireAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
*/
|
||||
public void setInheritGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
setPermission("group." + group.getName(), true, server, world, expireAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
public void unsetInheritGroup(Group group) throws ObjectLacksException {
|
||||
unsetInheritGroup(group, "global");
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
public void unsetInheritGroup(Group group, boolean temporary) throws ObjectLacksException {
|
||||
unsetInheritGroup(group, "global", temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
public void unsetInheritGroup(Group group, String server) throws ObjectLacksException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
unsetPermission("group." + group.getName(), server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
public void unsetInheritGroup(Group group, String server, String world) throws ObjectLacksException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
unsetPermission("group." + group.getName(), server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
public void unsetInheritGroup(Group group, String server, boolean temporary) throws ObjectLacksException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
unsetPermission("group." + group.getName(), server, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
*/
|
||||
public void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
unsetPermission("group." + group.getName(), server, world, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all of the groups permission nodes
|
||||
*/
|
||||
public void clearNodes() {
|
||||
getNodes().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of all of the groups the group inherits, on all servers
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
public List<String> getGroupNames() {
|
||||
return getGroups(null, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
public List<String> getLocalGroups(String server, String world) {
|
||||
return getGroups(server, world, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
public List<String> getLocalGroups(String server) {
|
||||
return getLocalGroups(server, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server with the option to include global
|
||||
* groups or all groups
|
||||
* @param server Which server to check on
|
||||
* @param world Which world to check on
|
||||
* @param includeGlobal Whether to include global groups
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
private List<String> getGroups(String server, String world, boolean includeGlobal) {
|
||||
// Call super #getPermissions method, and just sort through those
|
||||
Map<String, Boolean> perms = getPermissions(server, world, null, includeGlobal);
|
||||
return perms.keySet().stream()
|
||||
.filter(s -> Patterns.GROUP_MATCH.matcher(s).matches())
|
||||
.map(s -> Patterns.DOT_SPLIT.split(s, 2)[1])
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,9 @@ import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.utils.Patterns;
|
||||
import me.lucko.luckperms.utils.PermissionObject;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ToString(of = {"uuid"})
|
||||
@@ -74,6 +76,17 @@ public abstract class User extends PermissionObject {
|
||||
return hasPermission("group." + group.getName(), true, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a user is a member of a group on a specific server
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @return true if the user is a member of the group
|
||||
*/
|
||||
public boolean isInGroup(Group group, String server, String world) {
|
||||
return hasPermission("group." + group.getName(), true, server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user to a group
|
||||
* @param group The group to add the user to
|
||||
@@ -97,6 +110,21 @@ public abstract class User extends PermissionObject {
|
||||
setPermission("group." + group.getName(), true, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
*/
|
||||
public void addGroup(Group group, String server, String world) throws ObjectAlreadyHasException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
setPermission("group." + group.getName(), true, server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
* @param group The group to add the user to
|
||||
@@ -122,6 +150,22 @@ public abstract class User extends PermissionObject {
|
||||
setPermission("group." + group.getName(), true, server, expireAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
*/
|
||||
public void addGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
setPermission("group." + group.getName(), true, server, world, expireAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group the group to remove the user from
|
||||
@@ -155,6 +199,21 @@ public abstract class User extends PermissionObject {
|
||||
unsetPermission("group." + group.getName(), server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
*/
|
||||
public void removeGroup(Group group, String server, String world) throws ObjectLacksException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
unsetPermission("group." + group.getName(), server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group The group to remove the user from
|
||||
@@ -170,6 +229,22 @@ public abstract class User extends PermissionObject {
|
||||
unsetPermission("group." + group.getName(), server, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
*/
|
||||
public void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException {
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
unsetPermission("group." + group.getName(), server, world, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all of the users permission nodes
|
||||
*/
|
||||
@@ -187,96 +262,38 @@ public abstract class User extends PermissionObject {
|
||||
return getGroups(null, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
public List<String> getLocalGroups(String server, String world) {
|
||||
return getGroups(server, world, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
public List<String> getLocalGroups(String server) {
|
||||
return getGroups(server, null, false);
|
||||
return getLocalGroups(server, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server with the option to include global
|
||||
* groups or all groups
|
||||
* @param server Which server to check on
|
||||
* @param excludedGroups groups to exclude (prevents circular inheritance issues)
|
||||
* @param world Which world to check on
|
||||
* @param includeGlobal Whether to include global groups
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
private List<String> getGroups(String server, List<String> excludedGroups, boolean includeGlobal) {
|
||||
if (excludedGroups == null) {
|
||||
excludedGroups = new ArrayList<>();
|
||||
}
|
||||
|
||||
excludedGroups.add(getObjectName());
|
||||
List<String> groups = new ArrayList<>();
|
||||
|
||||
if (server == null || server.equals("")) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
/*
|
||||
Priority:
|
||||
|
||||
1. server specific group nodes
|
||||
2. group nodes
|
||||
*/
|
||||
|
||||
final Map<String, Boolean> serverSpecificGroups = new HashMap<>();
|
||||
final Map<String, Boolean> groupNodes = new HashMap<>();
|
||||
|
||||
// Sorts the permissions and puts them into a priority order
|
||||
for (Map.Entry<String, Boolean> node : convertTemporaryPerms().entrySet()) {
|
||||
serverSpecific:
|
||||
if (node.getKey().contains("/")) {
|
||||
String[] parts = Patterns.SERVER_SPLIT.split(node.getKey(), 2);
|
||||
|
||||
if (parts[0].equalsIgnoreCase("global")) {
|
||||
// REGULAR
|
||||
break serverSpecific;
|
||||
}
|
||||
|
||||
if (!parts[0].equalsIgnoreCase(server)) {
|
||||
// SERVER SPECIFIC BUT DOES NOT APPLY
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Patterns.GROUP_MATCH.matcher(parts[1]).matches()) {
|
||||
// SERVER SPECIFIC AND GROUP
|
||||
serverSpecificGroups.put(node.getKey(), node.getValue());
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip adding global permissions if they are not requested
|
||||
if (!includeGlobal) continue;
|
||||
|
||||
if (Patterns.GROUP_MATCH.matcher(node.getKey()).matches()) {
|
||||
// GROUP
|
||||
groupNodes.put(node.getKey(), node.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If a group is negated at a higher priority, the group should not then be applied at a lower priority
|
||||
serverSpecificGroups.entrySet().stream().filter(node -> !node.getValue()).forEach(node -> {
|
||||
groupNodes.remove(node.getKey());
|
||||
groupNodes.remove(Patterns.SERVER_SPLIT.split(node.getKey(), 2)[1]);
|
||||
});
|
||||
|
||||
groups.addAll(serverSpecificGroups.entrySet().stream()
|
||||
.filter(Map.Entry::getValue)
|
||||
.map(e -> Patterns.DOT_SPLIT.split(e.getKey(), 2)[1])
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
groups.addAll(groupNodes.entrySet().stream()
|
||||
.filter(Map.Entry::getValue)
|
||||
.map(e -> Patterns.DOT_SPLIT.split(e.getKey(), 2)[1])
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
return groups;
|
||||
private List<String> getGroups(String server, String world, boolean includeGlobal) {
|
||||
// Call super #getPermissions method, and just sort through those
|
||||
Map<String, Boolean> perms = getPermissions(server, world, null, includeGlobal);
|
||||
return perms.keySet().stream()
|
||||
.filter(s -> Patterns.GROUP_MATCH.matcher(s).matches())
|
||||
.map(s -> Patterns.DOT_SPLIT.split(s, 2)[1])
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package me.lucko.luckperms.users;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.data.Datastore;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -74,16 +73,6 @@ public abstract class UserManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a user object in the datastore
|
||||
* @param user the user to save
|
||||
* @param datastore the datastore
|
||||
*/
|
||||
public void saveUser(User user, Datastore datastore) {
|
||||
user.refreshPermissions();
|
||||
datastore.saveUser(user, success -> {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a user to the default group
|
||||
* @param user the user to give to
|
||||
|
||||
@@ -61,6 +61,10 @@ public abstract class LPConfiguration<T extends LuckPermsPlugin> {
|
||||
return getBoolean("include-global", defaultIncludeGlobal);
|
||||
}
|
||||
|
||||
public boolean getOnlineMode() {
|
||||
return getBoolean("online-mode", true);
|
||||
}
|
||||
|
||||
public String getDatabaseValue(String value) {
|
||||
return getString("sql." + value, null);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.regex.Pattern;
|
||||
@UtilityClass
|
||||
public class Patterns {
|
||||
public static final Pattern SERVER_SPLIT = Pattern.compile("\\/");
|
||||
public static final Pattern WORLD_SPLIT = Pattern.compile("\\-");
|
||||
public static final Pattern TEMP_SPLIT = Pattern.compile("\\$");
|
||||
public static final Pattern DOT_SPLIT = Pattern.compile("\\.");
|
||||
public static final Pattern GROUP_MATCH = Pattern.compile("group\\..*");
|
||||
|
||||
@@ -89,6 +89,18 @@ public abstract class PermissionObject {
|
||||
return hasPermission(server + "/" + node, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @return true if the user has the permission
|
||||
*/
|
||||
public boolean hasPermission(String node, boolean b, String server, String world) {
|
||||
return hasPermission(server + "-" + world + "/" + node, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
@@ -100,6 +112,31 @@ public abstract class PermissionObject {
|
||||
return hasPermission(node + (temporary ? "$a" : ""), b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server to check on
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user has the permission
|
||||
*/
|
||||
public boolean hasPermission(String node, boolean b, String server, boolean temporary) {
|
||||
return hasPermission(server + "/" + node + (temporary ? "$a" : ""), b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user has the permission
|
||||
*/
|
||||
public boolean hasPermission(String node, boolean b, String server, String world, boolean temporary) {
|
||||
return hasPermission(server + "-" + world + "/" + node + (temporary ? "$a" : ""), b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
@@ -124,10 +161,29 @@ public abstract class PermissionObject {
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
public boolean inheritsPermission(String node, boolean b, String server) {
|
||||
if (server.contains("-")) {
|
||||
// Use other method
|
||||
final String[] parts = Patterns.WORLD_SPLIT.split(server, 2);
|
||||
return inheritsPermission(node, b, parts[0], parts[1]);
|
||||
}
|
||||
|
||||
final Map<String, Boolean> local = getLocalPermissions(server, null);
|
||||
return hasPermission(local, node, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see the the object inherits a permission on a certain server
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
public boolean inheritsPermission(String node, boolean b, String server, String world) {
|
||||
final Map<String, Boolean> local = getLocalPermissions(server, world, null);
|
||||
return hasPermission(local, node, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
@@ -139,6 +195,31 @@ public abstract class PermissionObject {
|
||||
return inheritsPermission(node + (temporary ? "$a" : ""), b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
public boolean inheritsPermission(String node, boolean b, String server, boolean temporary) {
|
||||
return inheritsPermission(server + "/" + node + (temporary ? "$a" : ""), b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the user inherits the permission
|
||||
*/
|
||||
public boolean inheritsPermission(String node, boolean b, String server, String world, boolean temporary) {
|
||||
return inheritsPermission(server + "-" + world + "/" + node + (temporary ? "$a" : ""), b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to be set
|
||||
@@ -164,6 +245,18 @@ public abstract class PermissionObject {
|
||||
setPermission(server + "/" + node, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param world The world to set the permission on
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
*/
|
||||
public void setPermission(String node, boolean value, String server, String world) throws ObjectAlreadyHasException {
|
||||
setPermission(server + "-" + world + "/" + node, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to set
|
||||
@@ -187,6 +280,19 @@ public abstract class PermissionObject {
|
||||
setPermission(node + "$" + expireAt, value, server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param world The world to set the permission on
|
||||
* @param expireAt The time in unixtime when the permission will expire
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
*/
|
||||
public void setPermission(String node, boolean value, String server, String world, long expireAt) throws ObjectAlreadyHasException {
|
||||
setPermission(node + "$" + expireAt, value, server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
@@ -234,6 +340,17 @@ public abstract class PermissionObject {
|
||||
unsetPermission(server + "/" + node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param world The world to unset the node on
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
*/
|
||||
public void unsetPermission(String node, String server, String world) throws ObjectLacksException {
|
||||
unsetPermission(server + "-" + world + "/" + node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
@@ -245,6 +362,29 @@ public abstract class PermissionObject {
|
||||
unsetPermission(server + "/" + node, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param world The world to unset the node on
|
||||
* @param temporary if the permission being unset is temporary
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
*/
|
||||
public void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException {
|
||||
unsetPermission(server + "-" + world + "/" + node, temporary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server
|
||||
* @param server The server to get nodes for
|
||||
* @param world The world to get nodes for
|
||||
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
|
||||
* @return a {@link Map} of the permissions
|
||||
*/
|
||||
public Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups) {
|
||||
return getPermissions(server, world, excludedGroups, plugin.getConfiguration().getIncludeGlobalPerms());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the permissions and inherited permissions that apply to a specific server
|
||||
* @param server The server to get nodes for
|
||||
@@ -252,7 +392,7 @@ public abstract class PermissionObject {
|
||||
* @return a {@link Map} of the permissions
|
||||
*/
|
||||
public Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups) {
|
||||
return getPermissions(server, excludedGroups, plugin.getConfiguration().getIncludeGlobalPerms());
|
||||
return getLocalPermissions(server, null, excludedGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,7 +427,7 @@ public abstract class PermissionObject {
|
||||
.forEach(s -> this.nodes.remove(s));
|
||||
}
|
||||
|
||||
protected Map<String, Boolean> convertTemporaryPerms() {
|
||||
private Map<String, Boolean> convertTemporaryPerms() {
|
||||
auditTemporaryPermissions();
|
||||
|
||||
Map<String, Boolean> nodes = new HashMap<>();
|
||||
@@ -306,7 +446,7 @@ public abstract class PermissionObject {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private Map<String, Boolean> getPermissions(String server, List<String> excludedGroups, boolean includeGlobal) {
|
||||
protected Map<String, Boolean> getPermissions(String server, String world, List<String> excludedGroups, boolean includeGlobal) {
|
||||
if (excludedGroups == null) {
|
||||
excludedGroups = new ArrayList<>();
|
||||
}
|
||||
@@ -318,17 +458,25 @@ public abstract class PermissionObject {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
if (world != null && world.equalsIgnoreCase("")) {
|
||||
world = null;
|
||||
}
|
||||
|
||||
/*
|
||||
Priority:
|
||||
|
||||
1. server specific nodes
|
||||
2. user nodes
|
||||
3. server specific group nodes
|
||||
4. group nodes
|
||||
1. server+world specific nodes
|
||||
2. server specific nodes
|
||||
3. user nodes
|
||||
4. server+world specific group nodes
|
||||
5. server specific group nodes
|
||||
6. group nodes
|
||||
*/
|
||||
|
||||
final Map<String, Boolean> serverWorldSpecificNodes = new HashMap<>();
|
||||
final Map<String, Boolean> serverSpecificNodes = new HashMap<>();
|
||||
final Map<String, Boolean> userNodes = new HashMap<>();
|
||||
final Map<String, Boolean> serverWorldSpecificGroups = new HashMap<>();
|
||||
final Map<String, Boolean> serverSpecificGroups = new HashMap<>();
|
||||
final Map<String, Boolean> groupNodes = new HashMap<>();
|
||||
|
||||
@@ -337,6 +485,33 @@ public abstract class PermissionObject {
|
||||
serverSpecific:
|
||||
if (node.getKey().contains("/")) {
|
||||
String[] parts = Patterns.SERVER_SPLIT.split(node.getKey(), 2);
|
||||
// 0=server(+world) 1=node
|
||||
|
||||
// WORLD SPECIFIC
|
||||
if (parts[0].contains("-")) {
|
||||
String[] serverParts = Patterns.WORLD_SPLIT.split(parts[0], 2);
|
||||
// 0=server 1=world
|
||||
|
||||
if ((!serverParts[0].equalsIgnoreCase("global") || !includeGlobal) && (!serverParts[0].equalsIgnoreCase(server))) {
|
||||
// GLOBAL AND UNWANTED OR SERVER SPECIFIC BUT DOES NOT APPLY :(((
|
||||
continue;
|
||||
}
|
||||
|
||||
if (world != null && !serverParts[1].equalsIgnoreCase(world)) {
|
||||
// WORLD SPECIFIC BUT DOES NOT APPLY
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Patterns.GROUP_MATCH.matcher(parts[1]).matches()) {
|
||||
// SERVER+WORLD SPECIFIC AND GROUP
|
||||
serverWorldSpecificGroups.put(node.getKey(), node.getValue());
|
||||
continue;
|
||||
}
|
||||
|
||||
// SERVER+WORLD SPECIFIC
|
||||
serverWorldSpecificNodes.put(node.getKey(), node.getValue());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parts[0].equalsIgnoreCase("global")) {
|
||||
// REGULAR
|
||||
@@ -362,17 +537,30 @@ public abstract class PermissionObject {
|
||||
// Skip adding global permissions if they are not requested
|
||||
if (!includeGlobal) continue;
|
||||
|
||||
if (Patterns.GROUP_MATCH.matcher(node.getKey()).matches()) {
|
||||
// Could be here if the server was set to global.
|
||||
String n = node.getKey();
|
||||
if (n.contains("/")) {
|
||||
n = Patterns.SERVER_SPLIT.split(n, 2)[0];
|
||||
}
|
||||
|
||||
if (Patterns.GROUP_MATCH.matcher(n).matches()) {
|
||||
// GROUP
|
||||
groupNodes.put(node.getKey(), node.getValue());
|
||||
groupNodes.put(n, node.getValue());
|
||||
continue;
|
||||
}
|
||||
|
||||
// JUST NORMAL
|
||||
userNodes.put(node.getKey(), node.getValue());
|
||||
userNodes.put(n, node.getValue());
|
||||
}
|
||||
|
||||
// If a group is negated at a higher priority, the group should not then be applied at a lower priority
|
||||
serverWorldSpecificGroups.entrySet().stream().filter(node -> !node.getValue()).forEach(node -> {
|
||||
groupNodes.remove(node.getKey());
|
||||
groupNodes.remove(Patterns.SERVER_SPLIT.split(node.getKey(), 2)[1]);
|
||||
serverSpecificGroups.remove(node.getKey());
|
||||
serverSpecificGroups.remove(Patterns.SERVER_SPLIT.split(node.getKey(), 2)[1]);
|
||||
serverSpecificGroups.remove(Patterns.WORLD_SPLIT.split(node.getKey(), 2)[0] + "/" + Patterns.SERVER_SPLIT.split(node.getKey(), 2)[1]);
|
||||
});
|
||||
serverSpecificGroups.entrySet().stream().filter(node -> !node.getValue()).forEach(node -> {
|
||||
groupNodes.remove(node.getKey());
|
||||
groupNodes.remove(Patterns.SERVER_SPLIT.split(node.getKey(), 2)[1]);
|
||||
@@ -399,24 +587,26 @@ public abstract class PermissionObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Apply next priority: serverSpecificGroups
|
||||
for (Map.Entry<String, Boolean> groupNode : serverSpecificGroups.entrySet()) {
|
||||
final String rawNode = Patterns.SERVER_SPLIT.split(groupNode.getKey())[1];
|
||||
// Apply next priorities: serverSpecificGroups and then serverWorldSpecificGroups
|
||||
for (Map<String, Boolean> m : Arrays.asList(serverSpecificGroups, serverWorldSpecificGroups)) {
|
||||
for (Map.Entry<String, Boolean> groupNode : m.entrySet()) {
|
||||
final String rawNode = Patterns.SERVER_SPLIT.split(groupNode.getKey())[1];
|
||||
|
||||
// Add the actual group perm node, so other plugins can hook
|
||||
perms.put(rawNode, groupNode.getValue());
|
||||
// Add the actual group perm node, so other plugins can hook
|
||||
perms.put(rawNode, groupNode.getValue());
|
||||
|
||||
// Don't add negated groups
|
||||
if (!groupNode.getValue()) continue;
|
||||
// Don't add negated groups
|
||||
if (!groupNode.getValue()) continue;
|
||||
|
||||
String groupName = Patterns.DOT_SPLIT.split(rawNode, 2)[1];
|
||||
if (!excludedGroups.contains(groupName)) {
|
||||
Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group != null) {
|
||||
perms.putAll(group.getLocalPermissions(server, excludedGroups));
|
||||
} else {
|
||||
plugin.getLogger().warning("Error whilst refreshing the permissions of '" + objectName + "'." +
|
||||
"\n The group '" + groupName + "' is not loaded.");
|
||||
String groupName = Patterns.DOT_SPLIT.split(rawNode, 2)[1];
|
||||
if (!excludedGroups.contains(groupName)) {
|
||||
Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group != null) {
|
||||
perms.putAll(group.getLocalPermissions(server, excludedGroups));
|
||||
} else {
|
||||
plugin.getLogger().warning("Error whilst refreshing the permissions of '" + objectName + "'." +
|
||||
"\n The group '" + groupName + "' is not loaded.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,10 +614,12 @@ public abstract class PermissionObject {
|
||||
// Apply next priority: userNodes
|
||||
perms.putAll(userNodes);
|
||||
|
||||
// Apply highest priority: serverSpecificNodes
|
||||
for (Map.Entry<String, Boolean> node : serverSpecificNodes.entrySet()) {
|
||||
final String rawNode = Patterns.SERVER_SPLIT.split(node.getKey())[1];
|
||||
perms.put(rawNode, node.getValue());
|
||||
// Apply final priorities: serverSpecificNodes and then serverWorldSpecificNodes
|
||||
for (Map<String, Boolean> m : Arrays.asList(serverSpecificNodes, serverWorldSpecificNodes)) {
|
||||
for (Map.Entry<String, Boolean> node : m.entrySet()) {
|
||||
final String rawNode = Patterns.SERVER_SPLIT.split(node.getKey())[1];
|
||||
perms.put(rawNode, node.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return perms;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package me.lucko.luckperms.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class UuidCache {
|
||||
|
||||
// External UUID --> Internal UUID
|
||||
private Map<UUID, UUID> cache;
|
||||
|
||||
@Getter
|
||||
private final boolean onlineMode;
|
||||
|
||||
public UuidCache(boolean onlineMode) {
|
||||
this.onlineMode = onlineMode;
|
||||
|
||||
if (!onlineMode) {
|
||||
cache = new ConcurrentHashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
public UUID getUUID(UUID external) {
|
||||
return onlineMode ? external : (cache.containsKey(external) ? cache.get(external) : external);
|
||||
}
|
||||
|
||||
public UUID getExternalUUID(UUID internal) {
|
||||
if (onlineMode) return internal;
|
||||
|
||||
Optional<UUID> external = cache.entrySet().stream().filter(e -> e.getValue().equals(internal)).map(Map.Entry::getKey).findFirst();
|
||||
return external.isPresent() ? external.get() : internal;
|
||||
}
|
||||
|
||||
public void addToCache(UUID external, UUID internal) {
|
||||
if (onlineMode) return;
|
||||
cache.put(external, internal);
|
||||
}
|
||||
|
||||
public void clearCache(UUID external) {
|
||||
if (onlineMode) return;
|
||||
cache.remove(external);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<groupId>me.lucko</groupId>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>${global.version}</version>
|
||||
<modules>
|
||||
<module>bukkit</module>
|
||||
<module>common</module>
|
||||
@@ -16,6 +16,10 @@
|
||||
</modules>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<global.version>1.4</global.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
Reference in new issue
Block a user