Record Class EliminationResult

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.elimination.EliminationResult
Record Components:
eliminatedPlayers - the players removed from the match, in the order they were removed
eliminatedTeams - the teams that lost their last member as a result
skipped - the players that were asked for but were not eliminable
reason - why nothing happened, when nothing did

public record EliminationResult(@NotNull List<UUID> eliminatedPlayers, @NotNull List<String> eliminatedTeams, @NotNull List<UUID> skipped, @Nullable String reason) extends Record
What an elimination request actually did.

An elimination is best-effort per player: a player who already left, was already a spectator or was never in the match is skipped rather than failing the whole batch, so the counts below are the authoritative record of what happened.

Since:
1.6.0
  • Constructor Details

    • EliminationResult

      public EliminationResult(@NotNull @NotNull List<UUID> eliminatedPlayers, @NotNull @NotNull List<String> eliminatedTeams, @NotNull @NotNull List<UUID> skipped, @Nullable @Nullable String reason)
      Creates an instance of a EliminationResult record class.
      Parameters:
      eliminatedPlayers - the value for the eliminatedPlayers record component
      eliminatedTeams - the value for the eliminatedTeams record component
      skipped - the value for the skipped record component
      reason - the value for the reason record component
  • Method Details

    • failed

      @NotNull public static @NotNull EliminationResult failed(@NotNull @NotNull String reason)
      Nothing was eliminated, and this is why.
    • of

      @NotNull public static @NotNull EliminationResult of(@NotNull @NotNull Collection<UUID> players, @NotNull @NotNull Collection<String> teams, @NotNull @NotNull Collection<UUID> skipped)
    • isSuccess

      public boolean isSuccess()
      Whether at least one player was eliminated.
    • playerCount

      public int playerCount()
    • teamCount

      public int teamCount()
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • eliminatedPlayers

      @NotNull public @NotNull List<UUID> eliminatedPlayers()
      Returns the value of the eliminatedPlayers record component.
      Returns:
      the value of the eliminatedPlayers record component
    • eliminatedTeams

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

      @NotNull public @NotNull List<UUID> skipped()
      Returns the value of the skipped record component.
      Returns:
      the value of the skipped record component
    • reason

      @Nullable public @Nullable String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component