Record Class CompetingSide

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.team.CompetingSide
Record Components:
id - the team id for a team side, or the player's UUID as text for a solo side
kind - whether this side is a team or a single player
teamId - the team id for a team side; null for a solo side
members - every member the side had when this snapshot was taken, alive or not
aliveMembers - the members still playing
eliminated - whether the side is out of the match

public record CompetingSide(@NotNull String id, @NotNull CompetingSide.Kind kind, @Nullable String teamId, @NotNull Set<UUID> members, @NotNull Set<UUID> aliveMembers, boolean eliminated) extends Record
One side competing for the win in a match: a team when the match is played in teams, otherwise a single player.

Win conditions and placements count sides, not teams. A solo match has no teams at all, so ZentrixGame.getTeams() is empty there while its sides are its players. A snapshot: it does not change as the match goes on.

Since:
1.8.0
  • Constructor Details

    • CompetingSide

      public CompetingSide(@NotNull @NotNull String id, @NotNull @NotNull CompetingSide.Kind kind, @Nullable @Nullable String teamId, @NotNull @NotNull Set<UUID> members, @NotNull @NotNull Set<UUID> aliveMembers, boolean eliminated)
      Creates an instance of a CompetingSide record class.
      Parameters:
      id - the value for the id record component
      kind - the value for the kind record component
      teamId - the value for the teamId record component
      members - the value for the members record component
      aliveMembers - the value for the aliveMembers record component
      eliminated - the value for the eliminated record component
  • Method Details

    • isAlive

      public boolean isAlive()
      Whether the side is still competing.
    • teamIdIfTeam

      @NotNull public @NotNull Optional<String> teamIdIfTeam()
      The team id, for a team side.
    • 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.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • kind

      @NotNull public @NotNull CompetingSide.Kind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • teamId

      @Nullable public @Nullable String teamId()
      Returns the value of the teamId record component.
      Returns:
      the value of the teamId record component
    • members

      @NotNull public @NotNull Set<UUID> members()
      Returns the value of the members record component.
      Returns:
      the value of the members record component
    • aliveMembers

      @NotNull public @NotNull Set<UUID> aliveMembers()
      Returns the value of the aliveMembers record component.
      Returns:
      the value of the aliveMembers record component
    • eliminated

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