Interface Permission<T>

Type Parameters:
T - the type of data that this permission can handle in isValidFor(PermissionHandler, Object). Used if you want to allow passing additional data to check if the permission is valid in a certain situation, you can default it to Object if you do not need it.
All Known Implementing Classes:
BasicPermission
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 Permission<T>
Representation of a permission granted to a CommandSender.
  • Method Summary

    Modifier and Type Method Description
    boolean isValidFor​(PermissionHandler permissionHandler, T data)
    Does the given CommandSender have the permission represented by this object?
    default Permission read​(Data source)
    Reads any required data for this permission from the given destination.
    default void write​(Data destination)
    Writes any required data for this permission inside the given destination.
  • Method Details

    • isValidFor

      boolean isValidFor​(@NotNull PermissionHandler permissionHandler, @Nullable T data)
      Does the given CommandSender have the permission represented by this object?

      Called with PermissionHandler.hasPermission(Permission), the CommandSender requires to both have this permission and validate the condition in this method.

      Parameters:
      permissionHandler - the permission handler
      data - the optional data (eg the number of home possible, placing a block at X position)
      Returns:
      true if the commandSender possesses this permission
    • write

      default void write​(@NotNull Data destination)
      Writes any required data for this permission inside the given destination.
      Parameters:
      destination - the Data to write to
    • read

      default Permission read​(@Nullable Data source)
      Reads any required data for this permission from the given destination.
      Parameters:
      source - the Data to read from
      Returns:
      this for chaining