Class PermissionManager

java.lang.Object
dev.cwhead.GravesX.manager.PermissionManager

public class PermissionManager extends Object
Manages permission checks for GravesX.
  • Constructor Details

    • PermissionManager

      public PermissionManager(Graves plugin)
      Creates a new permission manager.
      Parameters:
      plugin - the GravesX plugin instance
  • Method Details

    • hasGrantedPermission

      public boolean hasGrantedPermission(String permission, org.bukkit.entity.Player player)
      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 for
      player - the player whose permissions are being checked
      Returns:
      true if the player has the specified permission, false otherwise
    • 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 online Player using hasGrantedPermission(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 Player context, and offline permission lookups may be unsupported, incomplete, or require extra provider-specific work.

      Parameters:
      permission - the permission to check for
      offlinePlayer - the offline player whose permissions are being checked
      Returns:
      true if the offline player has the specified permission, false otherwise
    • hasGrantedPermissionOrOp

      public boolean hasGrantedPermissionOrOp(String permission, org.bukkit.entity.Player player)
      Returns true if the player has the permission OR is op.
      Parameters:
      permission - permission to check
      player - player to check
      Returns:
      true if granted or op
    • hasAnyGrantedPermission

      public boolean hasAnyGrantedPermission(org.bukkit.entity.Player player, String... permissions)
      Returns true if the player has at least one of the provided permissions.
      Parameters:
      player - player to check
      permissions - permissions to test
      Returns:
      true if any permission is granted
    • hasAllGrantedPermissions

      public boolean hasAllGrantedPermissions(org.bukkit.entity.Player player, String... permissions)
      Returns true if the player has all the provided permissions.
      Parameters:
      player - player to check
      permissions - 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 check
      permissions - 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 check
      permissions - permissions to test
      Returns:
      true if all permissions are granted
    • getActivePermissionProviderName

      public String 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