Interface PermissionHolder

All Known Subinterfaces:
TalePlayer

public interface PermissionHolder
Interface for entities that can have permissions.

This interface provides convenience methods for permission checking on entities like players. It wraps calls to the PermissionService.

Example Usage


 // On any PermissionHolder (like TalePlayer)
 if (player.hasPermission("cmd.teleport")) {
     // Execute teleport
 }

 // Get a dynamic limit
 int maxHomes = player.getPermissionValue("homes.limit").asInt(3);
 
See Also:
  • Method Details

    • getUniqueId

      String getUniqueId()
      Returns the unique identifier for this holder.

      This is used to look up permissions in the permission system.

      Returns:
      the unique identifier
    • hasPermission

      default boolean hasPermission(String permission)
      Checks if this holder has the specified permission.

      This is a convenience method equivalent to: PermissionService.getInstance().query(this, permission).isAllowed()

      Parameters:
      permission - the permission key to check
      Returns:
      true if the permission is ALLOW
    • hasPermission

      default boolean hasPermission(String permission, ContextSet context)
      Checks if this holder has the specified permission in a context.
      Parameters:
      permission - the permission key
      context - the context to check in
      Returns:
      true if the permission is ALLOW in the given context
    • getPermissionValue

      default PermissionResult getPermissionValue(String permission)
      Queries a permission and returns the full result.

      Use this when you need the payload value or tristate:

      
       int maxPlots = holder.getPermissionValue("plots.limit").asInt(1);
       
      Parameters:
      permission - the permission key
      Returns:
      the permission result
    • getPermissionValue

      default PermissionResult getPermissionValue(String permission, ContextSet context)
      Queries a permission with context and returns the full result.
      Parameters:
      permission - the permission key
      context - the context to check in
      Returns:
      the permission result