Class Requirement
java.lang.Object
io.github.lucfr1746.llibrary.requirement.Requirement
- Direct Known Subclasses:
HasExpRequirement
,HasLevelRequirement
,HasPermissionRequirement
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
evaluate
(org.bukkit.entity.Player player) Evaluates whether the player meets the requirement.Gets the actions that execute when the requirement is met.Gets the actions that execute when the requirement is not met.boolean
Checks if there are actions assigned for when the requirement is met.boolean
Checks if there are actions assigned for when the requirement is not met.setAcceptHandler
(List<Action> acceptHandler) Sets the actions to execute when the requirement is met.setDenyHandler
(List<Action> denyHandler) Sets the actions to execute when the requirement is not met.
-
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, otherwisefalse
.
-
setAcceptHandler
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
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
Gets the actions that execute when the requirement is met.- Returns:
- A list of acceptance actions.
-
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, otherwisefalse
.
-
hasDenyHandler
public boolean hasDenyHandler()Checks if there are actions assigned for when the requirement is not met.- Returns:
true
if there are denial actions, otherwisefalse
.
-