public class PermissionsManager extends Object
Constructor and Description |
---|
PermissionsManager(PlatformPlugin p,
BPConfig conf,
Debug d) |
Modifier and Type | Method and Description |
---|---|
void |
addGroup(Group group)
Adds a group to cache and database.
|
void |
addGroupInheritance(Group group,
Group toadd)
Adds the toadd group to the group as inheritance
|
void |
addGroupPerm(Group group,
String perm)
Deprecated.
|
void |
addGroupPerm(Group group,
String server,
String world,
String perm)
Adds a permission to a group.
|
void |
addGroupTimedInheritance(Group group,
TimedValue<Group> toadd)
Adds the toadd timed group to the group as inheritance
|
void |
addGroupTimedPerm(Group group,
String server,
String world,
TimedValue perm)
Adds a timed permission to a group.
|
void |
addGroupToCache(Group g) |
void |
addUser(User user)
Adds a user to cache and database.
|
void |
addUserGroup(User user,
Group group)
Adds the given group to the user.
|
void |
addUserPerm(User user,
String perm)
Deprecated.
|
void |
addUserPerm(User user,
String server,
String world,
String perm)
Adds a permission to a user.
|
void |
addUserTimedGroup(User user,
TimedValue<Group> group)
Adds the given timed group to the user.
|
void |
addUserTimedPerm(User user,
String server,
String world,
TimedValue perm)
Adds a timed permission to a user.
|
void |
addUserToCache(User u) |
int |
cleanup()
Cleans the permissions backEnd and wipes 0815 users.
|
User |
createTempUser(String playername,
UUID uuid)
Creates a temporary user with the given parameters and adds it to the users cache.
|
void |
deleteGroup(Group group)
Deletes a user from cache and database and validates all groups and users.
|
void |
deleteUser(User user)
Deletes a user from cache and database.
|
void |
disable()
Disables the permissions manager.
|
void |
enable()
Enables the permissions manager.
|
void |
format()
Formats the permissions backEnd.
|
List<Group> |
getDefaultGroups()
Gets a list of all groups that are marked as default and given to all users by default.
|
List<String> |
getDefaultGroupsString()
Gets a list of all groups that are marked as default and given to all users by default.
|
Group |
getGroup(String groupname)
Gets a group by its name.
|
List<Group> |
getGroups()
Gets an unmodifiable list of all groups
|
List<String> |
getGroupUsers(Group group)
Gets a list of all user which are in the given group
|
Map<UUID,String> |
getGroupUsersUUID(Group group)
Gets a list of all user and their UUIDs which are in the given group
|
List<Group> |
getLadderGroups(String ladder)
Gets all groups of the given ladder.
|
List<String> |
getLadders()
Gets a list of all existing ladders.
|
Group |
getMainGroup(User player)
Get the group of the player with the highesst rank.
|
Group |
getNextGroup(Group group)
Gets the next (higher) group in the same ladder.
|
Group |
getPreviousGroup(Group group)
Gets the previous (lower) group in the same ladder.
|
List<String> |
getRegisteredUsers()
Gets a list of all users
|
Map<UUID,String> |
getRegisteredUsersUUID()
Gets a list of all users and their uuids
|
User |
getUser(String usernameoruuid)
Gets a user by its name.
|
User |
getUser(String usernameoruuid,
boolean loadfromdb)
Gets a user by its name.
|
User |
getUser(UUID uuid)
Gets a user by its UUID.
|
User |
getUser(UUID uuid,
boolean loadfromdb)
Gets a user by its UUID.
|
List<User> |
getUsers()
Gets an unmodifiable list of all loaded users
|
void |
ladderGroup(Group group,
String ladder)
Set the ladder for the group.
|
void |
loadConfig()
Loads the configuration of the plugin from the config.yml file.
|
void |
loadPerms()
(Re)loads the all groups and online players from file/table.
|
void |
migrateBackEnd(BackEndType bet)
Migrates the permissions to the given backnd type.
|
void |
migrateUsePlayerNames(Map<UUID,String> playernames)
Converts the permissions database to use player names for player identification.
|
void |
migrateUseUUID(Map<String,UUID> uuids)
Converts the permissions database to use UUIDs for player identification.
|
void |
rankGroup(Group group,
int rank)
Sets the rank for the group.
|
void |
reload()
Reloads the config and permissions.
|
void |
reloadGroup(String group) |
void |
reloadGroups() |
void |
reloadUser(String user) |
void |
reloadUser(UUID uuid) |
void |
reloadUsers() |
void |
removeGroupFromCache(Group g) |
void |
removeGroupInheritance(Group group,
Group toremove)
Removes the toremove group from the group as inheritance
|
void |
removeGroupPerm(Group group,
String perm)
Deprecated.
|
void |
removeGroupPerm(Group group,
String server,
String world,
String perm)
Removes a permission from a group.
|
void |
removeGroupTimedInheritance(Group group,
Group toremove)
Removes the toremove timed group from the group as inheritance
|
void |
removeGroupTimedPerm(Group group,
String server,
String world,
String perm)
Removes a timed permission from a group.
|
void |
removeUserFromCache(User u) |
void |
removeUserGroup(User user,
Group group)
Removes the given group from the user.
|
void |
removeUserPerm(User user,
String perm)
Deprecated.
|
void |
removeUserPerm(User user,
String server,
String world,
String perm)
Removes a permission from a user.
|
void |
removeUserTimedGroup(User user,
Group group)
Removes the given timed group from the user.
|
void |
removeUserTimedPerm(User user,
String server,
String world,
String perm)
Removes a timed permission from a user.
|
void |
setGroupDefault(Group group,
boolean isdefault)
Sets if the the group is a default group.
|
void |
setGroupDisplay(Group group,
String display,
String server,
String world)
Sets the displayname of the group
|
void |
setGroupPrefix(Group group,
String prefix,
String server,
String world)
Sets the prefix for the group.
|
void |
setGroupSuffix(Group group,
String suffix,
String server,
String world)
Sets the suffix for the group.
|
void |
setUserDisplay(User user,
String display,
String server,
String world)
Sets the displayname of the group
|
void |
setUserPrefix(User user,
String prefix,
String server,
String world)
Sets the prefix for the group.
|
void |
setUserSuffix(User user,
String suffix,
String server,
String world)
Sets the suffix for the group.
|
void |
validateUsersGroups()
Validates all loaded groups and users and fixes invalid objects.
|
void |
weightGroup(Group group,
int weight)
Sets the weight for the group.
|
public PermissionsManager(PlatformPlugin p, BPConfig conf, Debug d)
public final void loadConfig()
public final void loadPerms()
public void enable()
public void disable()
public void reload()
public void validateUsersGroups()
public Group getMainGroup(User player)
player
- the user to get the main group ofNullPointerException
- if player is nullpublic Group getNextGroup(Group group)
group
- the group to get the next group ofIllegalArgumentException
- if the group ladder does not exist (anymore)public Group getPreviousGroup(Group group)
group
- the group to get the previous group ofIllegalArgumentException
- if the group ladder does not exist (anymore)public List<Group> getLadderGroups(String ladder)
ladder
- the ladder of the groups to getpublic List<String> getLadders()
public List<Group> getDefaultGroups()
public List<String> getDefaultGroupsString()
public Group getGroup(String groupname)
groupname
- the name of the group to getpublic User getUser(String usernameoruuid)
usernameoruuid
- the name or the UUID of the user to getpublic User getUser(String usernameoruuid, boolean loadfromdb)
usernameoruuid
- the name or the UUID of the user to getloadfromdb
- whether or not to load the user from the database if not already loadedpublic User getUser(UUID uuid)
uuid
- the uuid of the user to getpublic User getUser(UUID uuid, boolean loadfromdb)
uuid
- the uuid of the user to getloadfromdb
- whether or not to load the user from the database if not already loadedpublic User createTempUser(String playername, UUID uuid)
playername
- the name of the temporary useruuid
- the user of the temporary userpublic List<Group> getGroups()
public List<User> getUsers()
public List<String> getRegisteredUsers()
public Map<UUID,String> getRegisteredUsersUUID()
public List<String> getGroupUsers(Group group)
group
- the grouppublic Map<UUID,String> getGroupUsersUUID(Group group)
group
- the grouppublic void deleteUser(User user)
user
- the user to deletepublic void deleteGroup(Group group)
group
- the group the removepublic void addUser(User user)
user
- the user to addpublic void addGroup(Group group)
group
- the group to addpublic void format()
public int cleanup()
public void addUserGroup(User user, Group group)
user
- the user to add the group togroup
- the group to add to the userpublic void addUserTimedGroup(User user, TimedValue<Group> group)
user
- the user to add the group togroup
- the timed group to add to the userpublic void removeUserGroup(User user, Group group)
user
- the user to remove the group fromgroup
- the group to remove from the userpublic void removeUserTimedGroup(User user, Group group)
user
- the user to remove the group fromgroup
- the timed group to remove from the user@Deprecated public void addUserPerm(User user, String perm)
user
- the user to add the permission toperm
- the permission to add to the user@Deprecated public void removeUserPerm(User user, String perm)
user
- the user to remove the permission fromperm
- the permission to remove from the userpublic void addUserPerm(User user, String server, String world, String perm)
user
- the userserver
- optional: the serverworld
- optional: the worldperm
- the permission to addpublic void addUserTimedPerm(User user, String server, String world, TimedValue perm)
user
- the userserver
- optional: the serverworld
- optional: the worldperm
- the timed permission to addpublic void removeUserPerm(User user, String server, String world, String perm)
user
- the userserver
- optional: the serverworld
- optional: the worldperm
- the permission to removepublic void removeUserTimedPerm(User user, String server, String world, String perm)
user
- the userserver
- optional: the serverworld
- optional: the worldperm
- timed the permission to removepublic void setUserDisplay(User user, String display, String server, String world)
user
- the userdisplay
- the displayserver
- the server to set the display on; may be nullworld
- the world to ser the display in; may be nullpublic void setUserPrefix(User user, String prefix, String server, String world)
user
- the userprefix
- the prefixserver
- the server to set the prefix on; may be nullworld
- the world to ser the prefix in; may be nullpublic void setUserSuffix(User user, String suffix, String server, String world)
user
- the usersuffix
- the suffixserver
- the server to set the suffix on; may be nullworld
- the world to ser the suffix in; may be null@Deprecated public void addGroupPerm(Group group, String perm)
group
- the groupperm
- the permission to add@Deprecated public void removeGroupPerm(Group group, String perm)
group
- the groupperm
- the permission to removepublic void addGroupPerm(Group group, String server, String world, String perm)
group
- the groupserver
- optional: the serverworld
- optional: the worldperm
- the permission to addpublic void addGroupTimedPerm(Group group, String server, String world, TimedValue perm)
group
- the groupserver
- optional: the serverworld
- optional: the worldperm
- the timed permission to addpublic void removeGroupPerm(Group group, String server, String world, String perm)
group
- the groupserver
- optional: the serverworld
- optional: the worldperm
- the permission to removepublic void removeGroupTimedPerm(Group group, String server, String world, String perm)
group
- the groupserver
- optional: the serverworld
- optional: the worldperm
- the timed permission to removepublic void addGroupInheritance(Group group, Group toadd)
group
- the group which should inherittoadd
- the group which should be inheritedpublic void addGroupTimedInheritance(Group group, TimedValue<Group> toadd)
group
- the group which should inherittoadd
- the timed group which should be inheritedpublic void removeGroupInheritance(Group group, Group toremove)
group
- the group which should no longer inherittoremove
- the group which should no longer be inheritedpublic void removeGroupTimedInheritance(Group group, Group toremove)
group
- the group which should no longer inherittoremove
- the timed group which should no longer be inheritedpublic void ladderGroup(Group group, String ladder)
group
- the groupladder
- the ladder namepublic void rankGroup(Group group, int rank)
group
- the grouprank
- the rankpublic void weightGroup(Group group, int weight)
group
- the groupweight
- the weightpublic void setGroupDefault(Group group, boolean isdefault)
group
- the groupisdefault
- whether or not the group is aded by default to new userspublic void setGroupDisplay(Group group, String display, String server, String world)
group
- the groupdisplay
- the displayserver
- the server to set the display on; may be nullworld
- the world to ser the display in; may be nullpublic void setGroupPrefix(Group group, String prefix, String server, String world)
group
- the groupprefix
- the prefixserver
- the server to set the prefix on; may be nullworld
- the world to ser the prefix in; may be nullpublic void setGroupSuffix(Group group, String suffix, String server, String world)
group
- the groupsuffix
- the suffixserver
- the server to set the suffix on; may be nullworld
- the world to ser the suffix in; may be nullpublic void migrateBackEnd(BackEndType bet)
bet
- the backEnd type to migrate topublic void migrateUseUUID(Map<String,UUID> uuids)
uuids
- a map of player names and their corresponding UUIDspublic void migrateUsePlayerNames(Map<UUID,String> playernames)
playernames
- a map of UUIDs and their corresponding player namespublic void reloadUser(String user)
public void reloadUser(UUID uuid)
public void reloadGroup(String group)
public void reloadUsers()
public void reloadGroups()
public void addUserToCache(User u)
public void removeUserFromCache(User u)
public void addGroupToCache(Group g)
public void removeGroupFromCache(Group g)
Copyright © 2019. All rights reserved.