Record Class ScenarioVoteSnapshot
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.scenario.vote.ScenarioVoteSnapshot
- Record Components:
runtimeId- the match this vote belongs tostatus- where the vote standssecondsLeft- how long voting stays open, 0 once it closedeligible- the scenarios that could be voted fortallies- votes per scenario; scenarios with no votes are present with a count of 0votesByPlayer- what each player voted for, empty once voting closed and the session was clearedwinners- the locked-in winners, empty until the vote resolvesvoteLimit- how many scenarios one player may vote forwinnerCount- how many scenarios the vote electsallowChanges- whether a player may take a vote backvisibility- how much of the tally players may see
public record ScenarioVoteSnapshot(@NotNull String runtimeId, @NotNull ScenarioVoteStatus status, int secondsLeft, @NotNull Set<String> eligible, @NotNull Map<String,Integer> tallies, @NotNull Map<UUID,Set<String>> votesByPlayer, @NotNull List<String> winners, int voteLimit, int winnerCount, boolean allowChanges, @NotNull ScenarioVoteVisibility visibility)
extends Record
A detached read of one match's vote at a single moment.
Snapshots never change after they are handed out, so an addon can hold one without racing the live session.
- Since:
- 1.6.0
-
Constructor Summary
ConstructorsConstructorDescriptionScenarioVoteSnapshot(@NotNull String runtimeId, @NotNull ScenarioVoteStatus status, int secondsLeft, @NotNull Set<String> eligible, @NotNull Map<String, Integer> tallies, @NotNull Map<UUID, Set<String>> votesByPlayer, @NotNull List<String> winners, int voteLimit, int winnerCount, boolean allowChanges, @NotNull ScenarioVoteVisibility visibility) Creates an instance of aScenarioVoteSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowChangesrecord component.eligible()Returns the value of theeligiblerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisOpen()Whether players may still cast or change votes.@NotNull StringReturns the value of theruntimeIdrecord component.intReturns the value of thesecondsLeftrecord component.@NotNull ScenarioVoteStatusstatus()Returns the value of thestatusrecord component.tallies()Returns the value of thetalliesrecord component.final StringtoString()Returns a string representation of this record class.@NotNull ScenarioVoteVisibilityReturns the value of thevisibilityrecord component.intReturns the value of thevoteLimitrecord component.intHow many distinct players cast at least one vote.Returns the value of thevotesByPlayerrecord component.intHow many votes a scenario has.What one player voted for.intReturns the value of thewinnerCountrecord component.winners()Returns the value of thewinnersrecord component.
-
Constructor Details
-
ScenarioVoteSnapshot
public ScenarioVoteSnapshot(@NotNull @NotNull String runtimeId, @NotNull @NotNull ScenarioVoteStatus status, int secondsLeft, @NotNull @NotNull Set<String> eligible, @NotNull @NotNull Map<String, Integer> tallies, @NotNull @NotNull Map<UUID, Set<String>> votesByPlayer, @NotNull @NotNull List<String> winners, int voteLimit, int winnerCount, boolean allowChanges, @NotNull @NotNull ScenarioVoteVisibility visibility) Creates an instance of aScenarioVoteSnapshotrecord class.- Parameters:
runtimeId- the value for theruntimeIdrecord componentstatus- the value for thestatusrecord componentsecondsLeft- the value for thesecondsLeftrecord componenteligible- the value for theeligiblerecord componenttallies- the value for thetalliesrecord componentvotesByPlayer- the value for thevotesByPlayerrecord componentwinners- the value for thewinnersrecord componentvoteLimit- the value for thevoteLimitrecord componentwinnerCount- the value for thewinnerCountrecord componentallowChanges- the value for theallowChangesrecord componentvisibility- the value for thevisibilityrecord component
-
-
Method Details
-
isOpen
public boolean isOpen()Whether players may still cast or change votes. -
votesFor
How many votes a scenario has. -
votesOf
What one player voted for. -
voterCount
public int voterCount()How many distinct players cast at least one vote. -
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 '=='. -
runtimeId
Returns the value of theruntimeIdrecord component.- Returns:
- the value of the
runtimeIdrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
secondsLeft
public int secondsLeft()Returns the value of thesecondsLeftrecord component.- Returns:
- the value of the
secondsLeftrecord component
-
eligible
Returns the value of theeligiblerecord component.- Returns:
- the value of the
eligiblerecord component
-
tallies
Returns the value of thetalliesrecord component.- Returns:
- the value of the
talliesrecord component
-
votesByPlayer
Returns the value of thevotesByPlayerrecord component.- Returns:
- the value of the
votesByPlayerrecord component
-
winners
Returns the value of thewinnersrecord component.- Returns:
- the value of the
winnersrecord component
-
voteLimit
public int voteLimit()Returns the value of thevoteLimitrecord component.- Returns:
- the value of the
voteLimitrecord component
-
winnerCount
public int winnerCount()Returns the value of thewinnerCountrecord component.- Returns:
- the value of the
winnerCountrecord component
-
allowChanges
public boolean allowChanges()Returns the value of theallowChangesrecord component.- Returns:
- the value of the
allowChangesrecord component
-
visibility
Returns the value of thevisibilityrecord component.- Returns:
- the value of the
visibilityrecord component
-