Package dev.cwhead.GravesX.manager
Class PermissionManager
java.lang.Object
dev.cwhead.GravesX.manager.PermissionManager
Manages permission checks for GravesX.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the active permission provider used for checks.booleanhasAllGrantedPermissions(org.bukkit.entity.Player player, String... permissions) Returns true if the player has all the provided permissions.booleanhasAllGrantedPermissions(org.bukkit.entity.Player player, Collection<String> permissions) Returns true if the player has all the provided permissions.booleanhasAnyGrantedPermission(org.bukkit.entity.Player player, String... permissions) Returns true if the player has at least one of the provided permissions.booleanhasAnyGrantedPermission(org.bukkit.entity.Player player, Collection<String> permissions) Returns true if the player has at least one of the provided permissions.booleanhasGrantedPermission(String permission, org.bukkit.entity.Player player) Checks if the specified player has been granted the specified permission.booleanhasGrantedPermission(String permission, org.bukkit.OfflinePlayer offlinePlayer) Deprecated.This method is deprecated because permission state is not reliably available for offline players and may return false even when the player would have the permission while online (depending on the active permissions provider).booleanhasGrantedPermissionOrOp(String permission, org.bukkit.entity.Player player) Returns true if the player has the permission OR is op.booleanboolean
-
Constructor Details
-
PermissionManager
Creates a new permission manager.- Parameters:
plugin- the GravesX plugin instance
-
-
Method Details
-
hasGrantedPermission
Checks if the specified player has been granted the specified permission.This uses the best available permissions provider in this order:
- LuckPerms (if available)
- Vault permissions (if available)
- Bukkit's built-in
Permissible.hasPermission(String)fallback
A debug line is emitted indicating which provider was used and the result.
- Parameters:
permission- the permission to check forplayer- the player whose permissions are being checked- Returns:
trueif the player has the specified permission,falseotherwise
-
hasGrantedPermission
@Deprecated public boolean hasGrantedPermission(String permission, org.bukkit.OfflinePlayer offlinePlayer) Deprecated.This method is deprecated because permission state is not reliably available for offline players and may return false even when the player would have the permission while online (depending on the active permissions provider). Prefer checking permissions on an onlinePlayerusinghasGrantedPermission(String, Player).Checks if the specified offline player has been granted the specified permission.Note: Permission checks are only reliably available for online players. Many permission implementations (including Bukkit's built-in permissions) evaluate permissions against an active
Playercontext, and offline permission lookups may be unsupported, incomplete, or require extra provider-specific work.- Parameters:
permission- the permission to check forofflinePlayer- the offline player whose permissions are being checked- Returns:
trueif the offline player has the specified permission,falseotherwise
-
hasGrantedPermissionOrOp
Returns true if the player has the permission OR is op.- Parameters:
permission- permission to checkplayer- player to check- Returns:
- true if granted or op
-
hasAnyGrantedPermission
Returns true if the player has at least one of the provided permissions.- Parameters:
player- player to checkpermissions- permissions to test- Returns:
- true if any permission is granted
-
hasAllGrantedPermissions
Returns true if the player has all the provided permissions.- Parameters:
player- player to checkpermissions- permissions to test- Returns:
- true if all permissions are granted
-
hasAnyGrantedPermission
public boolean hasAnyGrantedPermission(org.bukkit.entity.Player player, Collection<String> permissions) Returns true if the player has at least one of the provided permissions.- Parameters:
player- player to checkpermissions- permissions to test- Returns:
- true if any permission is granted
-
hasAllGrantedPermissions
public boolean hasAllGrantedPermissions(org.bukkit.entity.Player player, Collection<String> permissions) Returns true if the player has all the provided permissions.- Parameters:
player- player to checkpermissions- permissions to test- Returns:
- true if all permissions are granted
-
getActivePermissionProviderName
Returns the name of the active permission provider used for checks.- Returns:
- provider name (LuckPerms, Vault, Bukkit)
-
isUsingLuckPerms
public boolean isUsingLuckPerms()- Returns:
- true if LuckPerms is being used for permission checks
-
isUsingVaultPermissions
public boolean isUsingVaultPermissions()- Returns:
- true if Vault permissions are being used for permission checks
-