Interface PermissionCheckCallback

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PermissionCheckCallback
Called after a permission provider calculates a result but before the game receives it.

This event allows plugins to temporarily override permissions without modifying the underlying permission data. Common use cases include:

  • Denying all commands during a minigame match
  • Granting temporary permissions during an event
  • Implementing custom permission logic based on game state

Example Usage


 // Deny all teleport commands during a match
 PermissionCheckCallback.EVENT.register((player, key, context, result) -> {
     if (matchManager.isInMatch(player) && key.startsWith("cmd.teleport")) {
         return CheckResult.deny(); // Override to DENY
     }
     return CheckResult.unmodified(); // Keep original result
 });

 // Grant temporary fly permission during an event
 PermissionCheckCallback.EVENT.register((player, key, context, result) -> {
     if (eventManager.hasTemporaryFlight(player) && key.equals("ability.fly")) {
         return CheckResult.allow();
     }
     return CheckResult.unmodified();
 });
 

Priority

Listeners with higher EventPriority run first and can override the result for subsequent listeners. Use HIGHEST priority for security-critical overrides.

  • Field Details

  • Method Details

    • onPermissionCheck

      PermissionCheckCallback.CheckResult onPermissionCheck(TalePlayer player, String key, ContextSet context, PermissionResult result)
      Called when a permission is being checked.
      Parameters:
      player - the player whose permission is being checked
      key - the permission key being queried
      context - the context of the check
      result - the current permission result (from provider or previous listeners)
      Returns:
      a CheckResult indicating whether to modify the result