Class PermissionAPI

java.lang.Object
dev.cwhead.GravesX.api.permission.PermissionAPI

public final class PermissionAPI extends Object
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 Details

    • PermissionAPI

      public PermissionAPI(@NotNull @NotNull Graves plugin)
      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 node
      player - 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 PermissionManager for reliability caveats; this method delegates to that same behavior to keep results consistent.

      Parameters:
      permission - permission node
      offlinePlayer - 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 node
      player - 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 player
      permissions - 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 player
      permissions - 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 player
      permissions - 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 player
      permissions - permissions to test
      Returns:
      true if all granted
    • getActivePermissionProviderName

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