Record Class CooldownType
java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.server.cooldown.CooldownType
- Record Components:
id- The unique namespace identifier for the cooldown.defaultDuration- The standard length of the cooldown.defaultUnit- The time unit scaling the duration.defaultPolicy- The policy defining how the cooldown behaves across sessions or resets.
public record CooldownType(net.kyori.adventure.key.Key id, long defaultDuration, TimeUnit defaultUnit, CooldownPolicy defaultPolicy)
extends Record
Defines a structured cooldown configuration, representing its identifier,
standard duration, unit of measurement, and behavioral enforcement policy.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<CooldownType> The codec responsible for serializing and deserializing cooldown types securely natively. -
Constructor Summary
ConstructorsConstructorDescriptionCooldownType(net.kyori.adventure.key.Key id, long defaultDuration, TimeUnit defaultUnit) Constructs a standard cooldown configuration utilizing the default keeping policy.CooldownType(net.kyori.adventure.key.Key id, long defaultDuration, TimeUnit defaultUnit, CooldownPolicy defaultPolicy) Creates an instance of aCooldownTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thedefaultDurationrecord component.Returns the value of thedefaultPolicyrecord component.Returns the value of thedefaultUnitrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.kyori.adventure.key.Keyid()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing cooldown types securely natively.
-
-
Constructor Details
-
CooldownType
Constructs a standard cooldown configuration utilizing the default keeping policy.- Parameters:
id- The unique namespace identifier.defaultDuration- The length of the cooldown.defaultUnit- The associated time unit.
-
CooldownType
public CooldownType(net.kyori.adventure.key.Key id, long defaultDuration, TimeUnit defaultUnit, CooldownPolicy defaultPolicy) Creates an instance of aCooldownTyperecord class.- Parameters:
id- the value for theidrecord componentdefaultDuration- the value for thedefaultDurationrecord componentdefaultUnit- the value for thedefaultUnitrecord componentdefaultPolicy- the value for thedefaultPolicyrecord component
-
-
Method Details
-
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
-
defaultDuration
public long defaultDuration()Returns the value of thedefaultDurationrecord component.- Returns:
- the value of the
defaultDurationrecord component
-
defaultUnit
Returns the value of thedefaultUnitrecord component.- Returns:
- the value of the
defaultUnitrecord component
-
defaultPolicy
Returns the value of thedefaultPolicyrecord component.- Returns:
- the value of the
defaultPolicyrecord component
-