Record Class PhaseRuntimeState

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.phase.PhaseRuntimeState
Record Components:
status - where the timeline is
phaseNames - the names of the phases this match runs, in order; empty when the match captured none yet
currentIndex - the index of the running phase in phaseNames; -1 unless PhaseRuntimeState.Status.RUNNING or PhaseRuntimeState.Status.PAUSED
durationSeconds - the running phase's configured length; 0 without one
elapsedSeconds - how long the running phase has been running; 0 without one
remainingSeconds - 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
  • 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 a PhaseRuntimeState record class.
      Parameters:
      status - the value for the status record component
      phaseNames - the value for the phaseNames record component
      currentIndex - the value for the currentIndex record component
      durationSeconds - the value for the durationSeconds record component
      elapsedSeconds - the value for the elapsedSeconds record component
      remainingSeconds - the value for the remainingSeconds record component
  • Method Details

    • currentPhaseName

      @NotNull public @NotNull Optional<String> currentPhaseName()
      The running phase's name.
    • nextPhaseName

      @NotNull public @NotNull Optional<String> nextPhaseName()
      The name of the phase that follows the running one; empty during the last phase.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • status

      @NotNull public @NotNull PhaseRuntimeState.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • phaseNames

      @NotNull public @NotNull List<String> phaseNames()
      Returns the value of the phaseNames record component.
      Returns:
      the value of the phaseNames record component
    • currentIndex

      public int currentIndex()
      Returns the value of the currentIndex record component.
      Returns:
      the value of the currentIndex record component
    • durationSeconds

      public int durationSeconds()
      Returns the value of the durationSeconds record component.
      Returns:
      the value of the durationSeconds record component
    • elapsedSeconds

      public int elapsedSeconds()
      Returns the value of the elapsedSeconds record component.
      Returns:
      the value of the elapsedSeconds record component
    • remainingSeconds

      public int remainingSeconds()
      Returns the value of the remainingSeconds record component.
      Returns:
      the value of the remainingSeconds record component