Record Class ScenarioSelection

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.scenario.ScenarioSelection
Record Components:
runtimeId - the match the selection belongs to
mode - how the set was decided
scenarioIds - the scenarios, highest priority first
validation - what validation made of the set while it was being locked in
locked - whether the set is final; a pending vote is not

public record ScenarioSelection(@NotNull String runtimeId, @NotNull ScenarioSelectionMode mode, @NotNull List<String> scenarioIds, @NotNull ScenarioValidation validation, boolean locked) extends Record
The scenarios one match settled on, in the order they activate.

A selection is locked before the match leaves the waiting lobby and never changes afterwards, which is what makes a running match immune to configuration reloads, votes that arrive late, and scenarios being registered or unregistered mid-game.

Since:
1.6.0
  • Constructor Details

    • ScenarioSelection

      public ScenarioSelection(@NotNull @NotNull String runtimeId, @NotNull @NotNull ScenarioSelectionMode mode, @NotNull @NotNull List<String> scenarioIds, @NotNull @NotNull ScenarioValidation validation, boolean locked)
      Creates an instance of a ScenarioSelection record class.
      Parameters:
      runtimeId - the value for the runtimeId record component
      mode - the value for the mode record component
      scenarioIds - the value for the scenarioIds record component
      validation - the value for the validation record component
      locked - the value for the locked record component
  • Method Details

    • empty

      @NotNull public static @NotNull ScenarioSelection empty(@NotNull @NotNull String runtimeId, @NotNull @NotNull ScenarioSelectionMode mode)
      An empty, locked selection, for matches that run no scenarios at all.
    • isEmpty

      public boolean isEmpty()
    • contains

      public boolean contains(@NotNull @NotNull String scenarioId)
    • primary

      @NotNull public @NotNull Optional<String> primary()
      The first scenario, for matches that only ever run one.
    • 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.
    • runtimeId

      @NotNull public @NotNull String runtimeId()
      Returns the value of the runtimeId record component.
      Returns:
      the value of the runtimeId record component
    • mode

      @NotNull public @NotNull ScenarioSelectionMode mode()
      Returns the value of the mode record component.
      Returns:
      the value of the mode record component
    • scenarioIds

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

      @NotNull public @NotNull ScenarioValidation validation()
      Returns the value of the validation record component.
      Returns:
      the value of the validation record component
    • locked

      public boolean locked()
      Returns the value of the locked record component.
      Returns:
      the value of the locked record component