Package dev.itsharshxd.zentrix.api.perk
Record Class ServerBoost
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.perk.ServerBoost
- Record Components:
id- identifies the boost, for ending it earlyperkKey- the key of the perk it boosts, built-in or addonamount- added to a number perk; ignored by a togglestartedAt- when it startedexpiresAt- when it endssource- who or what started it, such as an administrator's name
public record ServerBoost(@NotNull String id, @NotNull String perkKey, int amount, @NotNull Instant startedAt, @NotNull Instant expiresAt, @NotNull String source)
extends Record
A timed boost that applies to every player, such as one extra host slot for an event weekend.
A snapshot.
Server-wide boosts stack with personal ones: a number boost adds amount, and a
toggle boost allows the perk. They are stored in the shared database, so they last across
restarts and apply on every server using it.
- Since:
- 1.16.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintamount()Returns the value of theamountrecord component.final booleanIndicates whether some other object is "equal to" this one.@NotNull InstantReturns the value of theexpiresAtrecord component.getPerk()The built-in perk it boosts, or empty for an addon perk.@NotNull DurationHow long the boost lasts from now; zero once it ended.final inthashCode()Returns a hash code value for this object.@NotNull Stringid()Returns the value of theidrecord component.booleanisActive()Whether the boost still applies.@NotNull StringperkKey()Returns the value of theperkKeyrecord component.@NotNull Stringsource()Returns the value of thesourcerecord component.@NotNull InstantReturns the value of thestartedAtrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ServerBoost
public ServerBoost(@NotNull @NotNull String id, @NotNull @NotNull String perkKey, int amount, @NotNull @NotNull Instant startedAt, @NotNull @NotNull Instant expiresAt, @NotNull @NotNull String source) Creates an instance of aServerBoostrecord class.- Parameters:
id- the value for theidrecord componentperkKey- the value for theperkKeyrecord componentamount- the value for theamountrecord componentstartedAt- the value for thestartedAtrecord componentexpiresAt- the value for theexpiresAtrecord componentsource- the value for thesourcerecord component
-
-
Method Details
-
getPerk
The built-in perk it boosts, or empty for an addon perk. -
isActive
public boolean isActive()Whether the boost still applies. -
getRemaining
How long the boost lasts from now; zero once it ended. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
perkKey
Returns the value of theperkKeyrecord component.- Returns:
- the value of the
perkKeyrecord component
-
amount
public int amount()Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-
startedAt
Returns the value of thestartedAtrecord component.- Returns:
- the value of the
startedAtrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-