Package dev.itsharshxd.zentrix.api.phase
Record Class PhaseRuntimeState
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.phase.PhaseRuntimeState
- Record Components:
status- where the timeline isphaseNames- the names of the phases this match runs, in order; empty when the match captured none yetcurrentIndex- the index of the running phase inphaseNames; -1 unlessPhaseRuntimeState.Status.RUNNINGorPhaseRuntimeState.Status.PAUSEDdurationSeconds- the running phase's configured length; 0 without oneelapsedSeconds- how long the running phase has been running; 0 without oneremainingSeconds- how long until it ends; 0 without one or while paused
public record PhaseRuntimeState(@NotNull PhaseRuntimeState.Status status, @NotNull List<String> phaseNames, int currentIndex, int durationSeconds, int elapsedSeconds, int remainingSeconds)
extends Record
Where one match is in its phase timeline, read at one moment. A snapshot.
A match captures its phase sequence when it is created, so this describes the phases it
actually runs even after gameplay/phases.yml was reloaded or phases were registered or
unregistered - unlike the global queries of PhaseService, which describe the current
configuration.
- Since:
- 1.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhere a match's phase timeline is. -
Constructor Summary
ConstructorsConstructorDescriptionPhaseRuntimeState(@NotNull PhaseRuntimeState.Status status, @NotNull List<String> phaseNames, int currentIndex, int durationSeconds, int elapsedSeconds, int remainingSeconds) Creates an instance of aPhaseRuntimeStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecurrentIndexrecord component.The running phase's name.intReturns the value of thedurationSecondsrecord component.intReturns the value of theelapsedSecondsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.The name of the phase that follows the running one; empty during the last phase.Returns the value of thephaseNamesrecord component.intReturns the value of theremainingSecondsrecord component.@NotNull PhaseRuntimeState.Statusstatus()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PhaseRuntimeState
public PhaseRuntimeState(@NotNull @NotNull PhaseRuntimeState.Status status, @NotNull @NotNull List<String> phaseNames, int currentIndex, int durationSeconds, int elapsedSeconds, int remainingSeconds) Creates an instance of aPhaseRuntimeStaterecord class.- Parameters:
status- the value for thestatusrecord componentphaseNames- the value for thephaseNamesrecord componentcurrentIndex- the value for thecurrentIndexrecord componentdurationSeconds- the value for thedurationSecondsrecord componentelapsedSeconds- the value for theelapsedSecondsrecord componentremainingSeconds- the value for theremainingSecondsrecord component
-
-
Method Details
-
currentPhaseName
The running phase's name. -
nextPhaseName
The name of the phase that follows the running one; empty during the last phase. -
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 '=='. -
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
phaseNames
Returns the value of thephaseNamesrecord component.- Returns:
- the value of the
phaseNamesrecord component
-
currentIndex
public int currentIndex()Returns the value of thecurrentIndexrecord component.- Returns:
- the value of the
currentIndexrecord component
-
durationSeconds
public int durationSeconds()Returns the value of thedurationSecondsrecord component.- Returns:
- the value of the
durationSecondsrecord component
-
elapsedSeconds
public int elapsedSeconds()Returns the value of theelapsedSecondsrecord component.- Returns:
- the value of the
elapsedSecondsrecord component
-
remainingSeconds
public int remainingSeconds()Returns the value of theremainingSecondsrecord component.- Returns:
- the value of the
remainingSecondsrecord component
-