java.lang.Object
java.lang.Enum<Limit>
nl.pim16aap2.animatedarchitecture.core.util.Limit
All Implemented Interfaces:
Serializable, Comparable<Limit>, Constable

public enum Limit extends Enum<Limit>
Represents a limit that can be set for a player.

Each limit has a user permission and an admin permission. The user permission is used to determine the limit for a player by checking the highest numerical suffix of the permission node. The admin permission is used to bypass the limit altogether.

  • Enum Constant Details

    • STRUCTURE_SIZE

      public static final Limit STRUCTURE_SIZE
      The maximum size a structure can have in number of blocks.
    • STRUCTURE_COUNT

      public static final Limit STRUCTURE_COUNT
      The maximum number of structures a player can own.
    • POWERBLOCK_DISTANCE

      public static final Limit POWERBLOCK_DISTANCE
      The maximum distance a power block can be from a structure.
    • BLOCKS_TO_MOVE

      public static final Limit BLOCKS_TO_MOVE
      The maximum distance a structure can move measured in blocks.

      This does not take the number of blocks the structure actually moves into account, only the distance the structure moves.

  • Method Details

    • values

      public static Limit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Limit valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getGlobalLimit

      public OptionalInt getGlobalLimit(IConfig config)
      Gets the global limit for this limit.
      Parameters:
      config - The config to get the global limit from.
      Returns:
      The global limit for this limit as defined in the config.
    • getUserPermission

      public String getUserPermission()
      The permission node for the user to determine the limit.

      The limit for a player is determined by checking the highest numerical suffix of this permission node.

      Returns:
      The permission node for the user to determine the limit.
    • getAdminPermission

      public String getAdminPermission()
      The permission node for an admin to bypass the limit.
      Returns:
      The permission node for an admin to bypass the limit.