Interface PermissionFunction

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 PermissionFunction
Functional interface for checking permissions.

This is the core hook point for permission plugins like LuckPerms. A permission function takes a permission string and returns a Tristate indicating whether the permission is granted, denied, or undefined.

Example implementation:

PermissionFunction func = permission -> {
    if (permission.startsWith("admin.")) {
        return Tristate.FALSE; // Deny all admin permissions
    }
    return Tristate.UNDEFINED; // Defer to default
};
See Also:
  • Field Details

  • Method Details

    • getPermissionValue

      @Nonnull Tristate getPermissionValue(@Nonnull String permission)
      Gets the permission value for the given permission string.
      Parameters:
      permission - the permission to check (e.g., "numdrassl.command.server")
      Returns:
      the tristate permission value
    • withFallback

      @Nonnull default PermissionFunction withFallback(@Nonnull PermissionFunction other)
      Creates a new permission function that checks this function first, and falls back to the other function if this returns Tristate.UNDEFINED.
      Parameters:
      other - the fallback function
      Returns:
      a combined permission function