Interface Subject

All Known Subinterfaces:
Actor, Player, SessionOwner
All Known Implementing Classes:
AbstractCommandBlockActor, AbstractNonPlayerActor, AbstractPlayerActor, AsyncPlayer, LocationMaskedPlayerWrapper, PlayerProxy, SilentPlayerWrapper

public interface Subject
A subject has authorization attached to it.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkPermission(String permission)
    Check whether this subject has been granted the given permission and throw an exception on error.
    Get a list of groups that this subject is a part of.
    boolean
    hasPermission(String permission)
    Return whether this subject has the given permission.
    void
    setPermission(String permission, boolean value)
     
    default boolean
    Add and remove permissions from a subject to show and hide certain messages.
  • Method Details

    • getGroups

      String[] getGroups()
      Get a list of groups that this subject is a part of.
      Returns:
      an array containing a group name per entry
    • checkPermission

      void checkPermission(String permission) throws AuthorizationException
      Check whether this subject has been granted the given permission and throw an exception on error.
      Parameters:
      permission - the permission
      Throws:
      AuthorizationException - thrown if not permitted
    • hasPermission

      boolean hasPermission(String permission)
      Return whether this subject has the given permission.
      Parameters:
      permission - the permission
      Returns:
      true if permission is granted
    • togglePermission

      default boolean togglePermission(String permission)
      Add and remove permissions from a subject to show and hide certain messages.
      Parameters:
      permission - the permission
      Returns:
      false if the permission was removed, true if this subject has permission
    • setPermission

      void setPermission(String permission, boolean value)