Class PermissionAPI
java.lang.Object
dev.cwhead.GravesX.api.permission.PermissionAPI
Permission helpers exposed through the GravesX API.
This API delegates to GravesX's PermissionManager to ensure
permission checks follow the same provider order and debug logging behavior used internally.
Provider order:
- LuckPerms (if available)
- Vault permissions (if available)
- Bukkit fallback (online only)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull StringReturns the provider currently being used for permission checks.booleanhasAllGrantedPermissions(@NotNull org.bukkit.entity.Player player, @NotNull String... permissions) Returns true if the player has all of the provided permissions.booleanhasAllGrantedPermissions(@NotNull org.bukkit.entity.Player player, @NotNull Collection<String> permissions) Returns true if the player has all of the provided permissions.booleanhasAnyGrantedPermission(@NotNull org.bukkit.entity.Player player, @NotNull String... permissions) Returns true if the player has at least one of the provided permissions.booleanhasAnyGrantedPermission(@NotNull org.bukkit.entity.Player player, @NotNull Collection<String> permissions) Returns true if the player has at least one of the provided permissions.booleanhasGrantedPermission(@NotNull String permission, @NotNull org.bukkit.OfflinePlayer offlinePlayer) Checks whether an offline player has a permission using an offline-capable provider.booleanhasGrantedPermission(@NotNull String permission, @NotNull org.bukkit.entity.Player player) Checks whether an online player has a permission using the active permission provider.booleanhasGrantedPermissionOrOp(@NotNull String permission, @NotNull org.bukkit.entity.Player player) Returns true if the player has the permission OR is op.booleanboolean
-
Constructor Details
-
PermissionAPI
Creates a new permission API.- Parameters:
plugin- the active GravesX plugin instance
-
-
Method Details
-
hasGrantedPermission
public boolean hasGrantedPermission(@NotNull @NotNull String permission, @NotNull @NotNull org.bukkit.entity.Player player) Checks whether an online player has a permission using the active permission provider.- Parameters:
permission- permission nodeplayer- online player- Returns:
- true if granted
-
hasGrantedPermission
public boolean hasGrantedPermission(@NotNull @NotNull String permission, @NotNull @NotNull org.bukkit.OfflinePlayer offlinePlayer) Checks whether an offline player has a permission using an offline-capable provider.See the deprecated offline method in
PermissionManagerfor reliability caveats; this method delegates to that same behavior to keep results consistent.- Parameters:
permission- permission nodeofflinePlayer- offline player- Returns:
- true if granted (if determinable by provider), otherwise false
-
hasGrantedPermissionOrOp
public boolean hasGrantedPermissionOrOp(@NotNull @NotNull String permission, @NotNull @NotNull org.bukkit.entity.Player player) Returns true if the player has the permission OR is op.- Parameters:
permission- permission nodeplayer- online player- Returns:
- true if op or granted
-
hasAnyGrantedPermission
public boolean hasAnyGrantedPermission(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String... permissions) Returns true if the player has at least one of the provided permissions.- Parameters:
player- online playerpermissions- permissions to test- Returns:
- true if any granted
-
hasAllGrantedPermissions
public boolean hasAllGrantedPermissions(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String... permissions) Returns true if the player has all of the provided permissions.- Parameters:
player- online playerpermissions- permissions to test- Returns:
- true if all granted
-
hasAnyGrantedPermission
public boolean hasAnyGrantedPermission(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Collection<String> permissions) Returns true if the player has at least one of the provided permissions.- Parameters:
player- online playerpermissions- permissions to test- Returns:
- true if any granted
-
hasAllGrantedPermissions
public boolean hasAllGrantedPermissions(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Collection<String> permissions) Returns true if the player has all of the provided permissions.- Parameters:
player- online playerpermissions- permissions to test- Returns:
- true if all granted
-
getActivePermissionProviderName
Returns the provider currently being used for permission 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
-