Interface PermissionHolder

All Known Subinterfaces:
CommandSender
All Known Implementing Classes:
ConsoleSender, EditorClient, PlayerRef

public interface PermissionHolder
An interface for anything that can hold permissions.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Determines whether the associated instance has the given permission.
    default boolean
    hasPermission(PermissionQuery query, boolean def)
     
    boolean
    Whether their attached permissions contains the id.
    boolean
    hasPermission(String id, boolean def)
    Determines whether the associated instance has the given permission.
  • Method Details

    • hasPermission

      boolean hasPermission(@Nonnull String id)
      Whether their attached permissions contains the id. This will also attempt to find wildcard matches.

      For example, if their permissions contain "hytale.*", the check "hytale.permission-test" will return true.

      If they have the root "*" permission, all returns will be true.
      Parameters:
      id - the permission.
      Returns:
      true if they have the permission, false otherwise.
    • hasPermission

      boolean hasPermission(@Nonnull String id, boolean def)
      Determines whether the associated instance has the given permission.
      Parameters:
      id - The identifier of the permission.
      def - The default value to return if the player does not have the permission.
      Returns:
      true if they have the permission, false otherwise.
    • hasPermission

      default boolean hasPermission(@Nonnull PermissionQuery query)
      Determines whether the associated instance has the given permission.

      A holder that resolves permissions itself should override this, because a lookup built once and reused costs an order of magnitude less than one built for each check.

      Parameters:
      query - The lookup for the permission.
      Returns:
      true if they have the permission, false otherwise.
    • hasPermission

      default boolean hasPermission(@Nonnull PermissionQuery query, boolean def)
      Parameters:
      query - The lookup for the permission.
      def - The default value to return if nothing decides.
      Returns:
      true if they have the permission, false otherwise.
      See Also: