Class NumericConditional
java.lang.Object
dev.foxikle.customnpcs.actions.conditions.NumericConditional
- All Implemented Interfaces:
Conditional
The object representing a comparison of two numeric values
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.foxikle.customnpcs.actions.conditions.Conditional
Conditional.Comparator, Conditional.SelectionMode, Conditional.Type, Conditional.Value
-
Constructor Summary
ConstructorsConstructorDescriptionNumericConditional
(Conditional.Comparator comparator, Conditional.Value value, double target) -
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 NumericConditional
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
-
Constructor Details
-
NumericConditional
public NumericConditional(Conditional.Comparator comparator, Conditional.Value value, double target) - Parameters:
comparator
- the comparator to usevalue
- the value to comparetarget
- the target to compare to- See Also:
-
-
Method Details
-
compute
public boolean compute(org.bukkit.entity.Player player) Computes the condition to determine if the action should be executed- Specified by:
compute
in interfaceConditional
- Parameters:
player
- The player to fetch data from- Returns:
- if the action should be executed
-
toJson
Serializes the condition to json using Gson- Specified by:
toJson
in interfaceConditional
- Returns:
- the serialized condition
-
of
- Parameters:
data
- the serialized condition- Returns:
- the condition from the json
-
getType
Gets the type of condition- Specified by:
getType
in interfaceConditional
- Returns:
- the condition type
- See Also:
-
setComparator
Sets the comparator of this condition- Specified by:
setComparator
in interfaceConditional
- Parameters:
comparator
- the comparator to compare the value and target value- See Also:
-
setValue
Sets the value of this condition- Specified by:
setValue
in interfaceConditional
- Parameters:
value
- the value to compare- See Also:
-
setTargetValue
Sets the target value of this condition- Specified by:
setTargetValue
in interfaceConditional
- Parameters:
targetValue
- the target value
-
getValue
Gets the value the condition is comparing- Specified by:
getValue
in interfaceConditional
- Returns:
- the value the condition is comparing
- See Also:
-
getTarget
Gets the target of the condition- Specified by:
getTarget
in interfaceConditional
- Returns:
- returns the target value
-
getComparator
Gets the comparator the condition uses to compare the value and target value.- Specified by:
getComparator
in interfaceConditional
- Returns:
- the comparator
- See Also:
-
clone
Description copied from interface:Conditional
Clones this conditional object- Specified by:
clone
in interfaceConditional
- Overrides:
clone
in classObject
- Returns:
- the cloned object
-