Class TownyPerms
java.lang.Object
com.palmergames.bukkit.towny.permissions.TownyPerms
- Author:
- ElgarL
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final LinkedHashMap<String,
org.bukkit.permissions.Permission> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assignPermissions
(Resident resident, org.bukkit.entity.Player player) Register a specific residents permissions with Bukkit.static void
Update 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 String
getHighestPriorityRank
(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 ranksgetPermsOfGroup
(String group) static LinkedHashMap<String,
Boolean> getResidentPerms
(Resident resident) Returns a sorted map of this residents current permissions.static String
getResidentPrimaryRankPrefix
(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 ranksstatic CommentedConfiguration
static boolean
static void
initialize
(Towny plugin) static void
Load the townyperms.yml file.static boolean
mapHasGroup
(String group) static @Nullable String
matchNationRank
(String rank) Used to match a given rank to a case-sensitive Nation Rank.static @Nullable String
matchTownRank
(String rank) Used to match a given rank to a case-sensitive Town Rank.static void
static void
removeAttachment
(String name) Should only be called when a player leaves the server.static void
updateNationPerms
(Nation nation) Update the permissions for all residents of a nation (if online)static void
Update the permissions for all online residentsstatic void
updateTownPerms
(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.
-
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.
-
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() -
getResidentPrimaryRankPrefix
-
getHighestPriorityRank
-
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
-