Class LimitsManager

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.managers.LimitsManager

@Singleton public class LimitsManager extends Object
Manages the limits of players.

It checks the global limit, any admin bypass permission, and the player's personal limit.

  • Constructor Details

  • Method Details

    • getLimit

      public OptionalInt getLimit(IPlayer player, Limit limit)
      Gets the value of the Limit for the given player. It checks the global limit, any admin bypass permission, and the player's personal limit.
      Parameters:
      player - The player for whom to check the limit.
      limit - The Limit to check.
      Returns:
      The value of the limit for the given player, or an empty OptionalInt if none was found.

      If there is a global limit in place (see Limit.getGlobalLimit(IConfig)), the returned value cannot exceed this. Not even admins and OPs can bypass this limit.

      If the player has a player limit as well as a global limit, the lowest value of the two will be used.

    • exceedsLimit

      public boolean exceedsLimit(IPlayer player, Limit limit, int value)
      Checks if a given value exceeds the limit for this player. For more info, see getLimit(IPlayer, Limit).
      Parameters:
      player - The player for whom to check the limit.
      limit - The Limit to check.
      value - The value to compare to the limit.
      Returns:
      True if the given value exceeds the limit for this player. If value <= limit, this will return false.