Record Class UpgradeIntegerModifier
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.skill.modifier.UpgradeIntegerModifier
- Record Components:
value- the integer amount to add or subtracttype- the operation to perform (UpgradeNumberModifier.Type.AddorUpgradeNumberModifier.Type.Subtract)
- All Implemented Interfaces:
UpgradeModifier<Integer>
public record UpgradeIntegerModifier(Integer value, UpgradeNumberModifier.Type type)
extends Record
implements UpgradeModifier<Integer>
An
UpgradeModifier for integer-typed skill parameters.
Supports addition and subtraction. This is the integer-specific counterpart of
UpgradeNumberModifier and is preferred when the skill parameter is known to be
a whole number (e.g., beacon range in blocks, backpack row count).
-
Constructor Summary
ConstructorsConstructorDescriptionUpgradeIntegerModifier(Integer value, UpgradeNumberModifier.Type type) Creates an instance of aUpgradeIntegerModifierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Applies this modifier to the given current value, producing an updated result.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Method Details
-
modify
Applies this modifier to the given current value, producing an updated result.Adds or subtracts this modifier's value from the given current integer, depending on the configured
UpgradeNumberModifier.Type.- Specified by:
modifyin interfaceUpgradeModifier<Integer>- Parameters:
n- the current parameter value before modification- Returns:
- the modified parameter value
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
Returns the value of thevaluerecord component.- Specified by:
valuein interfaceUpgradeModifier<Integer>- Returns:
- the value of the
valuerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-