Class TownyPerms
java.lang.Object
com.palmergames.bukkit.towny.permissions.TownyPerms
- Author:
- ElgarL
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final LinkedHashMap<String, org.bukkit.permissions.Permission> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassignPermissions(Resident resident, org.bukkit.entity.Player player) Register a specific residents permissions with Bukkit.static voidUpdate the list of permissions registered with bukkitgetAllChildren(String node, Set<String> playerPermArray) Returns a map of ALL child permissions registered with bukkit null is emptygetAllRegisteredPermissions(boolean includeChildren) Fetch all permissions which are registered with superperms.getChildren(String node) Returns a map of the child permissions (1 node deep) as registered with Bukkit.Default permissions everyone getsstatic StringgetHighestPriorityRank(Resident resident, List<String> ranks, Function<String, List<String>> rankFunction) getNationDefault(String nationName) Default permissions everyone in a nation getsA nations kings permissionsGet a specific ranks permissionsFetch a list of all available nation ranksgetNationRanks(Nation nation) getPermsOfGroup(String group) static intgetRankNationLevelReq(String rank) static intgetRankTownLevelReq(String rank) static LinkedHashMap<String, Boolean> getResidentPerms(Resident resident) Returns a sorted map of this residents current permissions.static StringgetResidentPrimaryRankPrefix(Resident resident) getTownDefault(String townName) Default permissions everyone in a town getsA town mayors permissionsgetTownRankPermissions(String rank) Get a specific ranks permissionsFetch a list of all available town ranksgetTownRanks(Town town) static CommentedConfigurationstatic booleanstatic booleanstatic voidinitialize(Towny plugin) static voidLoad the townyperms.yml file.static booleanmapHasGroup(String group) static @Nullable StringmatchNationRank(String rank) Used to match a given rank to a case-sensitive Nation Rank.static @Nullable StringmatchTownRank(String rank) Used to match a given rank to a case-sensitive Town Rank.static booleanstatic booleanstatic voidstatic voidremoveAttachment(String name) Should only be called when a player leaves the server.static voidupdateNationPerms(Nation nation) Update the permissions for all residents of a nation (if online)static voidUpdate the permissions for all online residentsstatic voidupdateTownPerms(Town town) Update the permissions for all residents of a town (if online)
-
Field Details
-
registeredPermissions
protected static final LinkedHashMap<String,org.bukkit.permissions.Permission> registeredPermissions -
attachments
-
-
Constructor Details
-
TownyPerms
public TownyPerms()
-
-
Method Details
-
initialize
-
loadPerms
Load the townyperms.yml file. If it doesn't exist create it from the resource file in the jar.- Parameters:
permsYMLPath- - Path to townyperms.yml in the data directory.- Throws:
TownyInitException- - Thrown when if we fail to copy or load townyperms.yml.
-
assignPermissions
Register a specific residents permissions with Bukkit.- Parameters:
resident- - Resident to check if player is validplayer- - Player to register permission
-
removeAttachment
Should only be called when a player leaves the server.- Parameters:
name- - Player's name to remove attachment of
-
updateOnlinePerms
public static void updateOnlinePerms()Update the permissions for all online residents -
updateTownPerms
Update the permissions for all residents of a town (if online)- Parameters:
town- - Town to target
-
updateNationPerms
Update the permissions for all residents of a nation (if online)- Parameters:
nation- - Nation to target
-
getResidentPerms
Returns a sorted map of this residents current permissions.- Parameters:
resident- - Resident to check- Returns:
- a sorted Map of permission nodes
-
registerPermissionNodes
public static void registerPermissionNodes() -
getDefault
Default permissions everyone gets- Returns:
- a List of permissions
-
getTownRanks
Fetch a list of all available town ranks- Returns:
- a list of rank names.
-
getTownRanks
-
getTownDefault
Default permissions everyone in a town gets- Parameters:
townName- Name of town lowercased.- Returns:
- a list of permissions
-
getTownMayor
A town mayors permissions- Returns:
- a list of permissions
-
getTownRankPermissions
Get a specific ranks permissions- Parameters:
rank- - Rank to check permissions for- Returns:
- a List of permissions
-
getNationRanks
Fetch a list of all available nation ranks- Returns:
- a list of rank names.
-
getNationRanks
-
getNationDefault
Default permissions everyone in a nation gets- Parameters:
nationName- Name of nation lowercased.- Returns:
- a List of permissions
-
getNationKing
A nations kings permissions- Returns:
- a List of permissions
-
getNationRankPermissions
Get a specific ranks permissions- Parameters:
rank- - Rank to get permissions of- Returns:
- a List of Permissions
-
matchNationRank
Used to match a given rank to a case-sensitive Nation Rank.- Parameters:
rank- String representing the rank the user typed in.- Returns:
- String of the NationRank which matches or null;
-
matchTownRank
Used to match a given rank to a case-sensitive Town Rank.- Parameters:
rank- String representing the rank the user typed in.- Returns:
- String of the TownRank which matches or null;
-
hasPeacefulNodes
public static boolean hasPeacefulNodes() -
hasConqueredNodes
public static boolean hasConqueredNodes() -
getResidentPrimaryRankPrefix
-
getHighestPriorityRank
-
getRankTownLevelReq
-
getRankNationLevelReq
-
ranksWithTownLevelRequirementPresent
public static boolean ranksWithTownLevelRequirementPresent() -
ranksWithNationLevelRequirementPresent
public static boolean ranksWithNationLevelRequirementPresent() -
collectPermissions
public static void collectPermissions()Update the list of permissions registered with bukkit -
getAllRegisteredPermissions
Fetch all permissions which are registered with superperms. {can include child nodes)- Parameters:
includeChildren- - If child nodes should be included- Returns:
- List of all permission nodes
-
getAllChildren
Returns a map of ALL child permissions registered with bukkit null is empty- Parameters:
node- - Parent nodeplayerPermArray- current list of perms to check against for negations- Returns:
- Map of child permissions
-
getChildren
Returns a map of the child permissions (1 node deep) as registered with Bukkit. null is empty- Parameters:
node- - Parent node- Returns:
- Map of child permissions
-
getGroupList
-
mapHasGroup
-
getPermsOfGroup
-
getTownyPermsFile
-