Class Requirement

java.lang.Object
io.github.lucfr1746.llibrary.requirement.Requirement
Direct Known Subclasses:
HasExpRequirement, HasLevelRequirement, HasPermissionRequirement

public abstract class Requirement extends Object
Represents a requirement that must be evaluated for a player. Requirements can have actions executed upon acceptance or denial.

Extend it and register through RequirementLoader if you want to create a new requirement.

  • Constructor Details

    • Requirement

      public Requirement()
  • Method Details

    • evaluate

      public abstract boolean evaluate(org.bukkit.entity.Player player)
      Evaluates whether the player meets the requirement.
      Parameters:
      player - The player to evaluate.
      Returns:
      true if the requirement is met, otherwise false.
    • setAcceptHandler

      public Requirement setAcceptHandler(List<Action> acceptHandler)
      Sets the actions to execute when the requirement is met.
      Parameters:
      acceptHandler - The list of actions to execute on acceptance.
      Returns:
      The current requirement instance.
    • setDenyHandler

      public Requirement setDenyHandler(List<Action> denyHandler)
      Sets the actions to execute when the requirement is not met.
      Parameters:
      denyHandler - The list of actions to execute on denial.
      Returns:
      The current requirement instance.
    • getAcceptHandler

      public List<Action> getAcceptHandler()
      Gets the actions that execute when the requirement is met.
      Returns:
      A list of acceptance actions.
    • getDenyHandler

      public List<Action> getDenyHandler()
      Gets the actions that execute when the requirement is not met.
      Returns:
      A list of denial actions.
    • hasAcceptHandler

      public boolean hasAcceptHandler()
      Checks if there are actions assigned for when the requirement is met.
      Returns:
      true if there are acceptance actions, otherwise false.
    • hasDenyHandler

      public boolean hasDenyHandler()
      Checks if there are actions assigned for when the requirement is not met.
      Returns:
      true if there are denial actions, otherwise false.