Class PermissionValidator

java.lang.Object
com.ultikits.ultitools.abstracts.command.validation.validators.PermissionValidator
All Implemented Interfaces:
CommandValidator

public class PermissionValidator extends Object implements CommandValidator
Validates that the command sender has the required permission. Supports both class-level and method-level permission requirements.

As of 7.0, the Brigadier tree uses requires for class-level permissions and operator requirements, and on exclusive mapping paths for method-level requirements. The tree hides nodes a sender cannot use; shared prefixes remain available to their public mappings. Framework usage replies omit unavailable mappings, including mappings ending at a shared node.

Visibility is not a replacement for this validator. A reachable execution still checks its actual sender and current permissions here, including console and panel senders, redirected execution, shared nodes, and case-normalized re-dispatch. Both permission and operator checks remain live rather than being captured when the command tree is registered.

In 6.x, visibility used Bukkit's PluginCommand#setPermission; that registration path and BaseCommandExecutor.onCommand no longer exist.

Since:
6.2.0
Version:
2.0.0
Author:
wisdomme
  • Field Details

    • ORDER

      private static final int ORDER
      See Also:
    • basePermission

      private final String basePermission
    • requireOp

      private final boolean requireOp
  • Constructor Details

    • PermissionValidator

      public PermissionValidator()
      Creates a permission validator with no base permission requirement.
    • PermissionValidator

      public PermissionValidator(String permission, boolean requireOp)
      Creates a permission validator with the specified permission.
      Parameters:
      permission - the required permission
      requireOp - whether OP is required
  • Method Details