Interface Conditional
- All Known Implementing Classes:
LogicalConditional
,NumericConditional
public interface Conditional
The interface to represent a comparison
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
A list of comparators used to compare the values and target values of conditionsstatic enum
Represents if how the conditions should be computedstatic enum
A list of comparator typesstatic enum
A list of values the plugin can compare -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this conditional objectboolean
compute
(org.bukkit.entity.Player player) Computes the condition to determine if the action should be executedGets the comparator the condition uses to compare the value and target value.Gets the target of the conditiongetType()
Gets the type of conditiongetValue()
Gets the value the condition is comparingstatic Conditional
void
setComparator
(Conditional.Comparator comparator) Sets the comparator of this conditionvoid
setTargetValue
(String targetValue) Sets the target value of this conditionvoid
setValue
(Conditional.Value value) Sets the value of this conditiontoJson()
Serializes the condition to json using Gson
-
Method Details
-
compute
boolean compute(org.bukkit.entity.Player player) Computes the condition to determine if the action should be executed- Parameters:
player
- The player to fetch data from- Returns:
- if the action should be executed
-
toJson
String toJson()Serializes the condition to json using Gson- Returns:
- the serialized condition
-
of
- Parameters:
data
- the serialized condition- Returns:
- the condition from the json
-
getValue
Conditional.Value getValue()Gets the value the condition is comparing- Returns:
- the value the condition is comparing
- See Also:
-
getComparator
Conditional.Comparator getComparator()Gets the comparator the condition uses to compare the value and target value.- Returns:
- the comparator
- See Also:
-
getType
Conditional.Type getType()Gets the type of condition- Returns:
- the condition type
- See Also:
-
setComparator
Sets the comparator of this condition- Parameters:
comparator
- the comparator to compare the value and target value- See Also:
-
setValue
Sets the value of this condition- Parameters:
value
- the value to compare- See Also:
-
setTargetValue
Sets the target value of this condition- Parameters:
targetValue
- the target value
-
getTarget
String getTarget()Gets the target of the condition- Returns:
- returns the target value
-
clone
Conditional clone()Clones this conditional object- Returns:
- the cloned object
-