Package dev.deepcore.challenge.session
Class RunSaveVoteService
java.lang.Object
dev.deepcore.challenge.session.RunSaveVoteService
Collects unanimous player votes to save the current speedrun to disk.
-
Constructor Summary
ConstructorsConstructorDescriptionRunSaveVoteService(org.bukkit.plugin.java.JavaPlugin plugin, DeepCoreLogger log, Supplier<List<org.bukkit.entity.Player>> onlineParticipantsSupplier) Creates a run-save vote service. -
Method Summary
Modifier and TypeMethodDescriptionbooleanRecords a vote from the given player and triggers the save callback when all online participants have voted.voidCancels any pending vote and clears all recorded votes.
-
Constructor Details
-
RunSaveVoteService
public RunSaveVoteService(org.bukkit.plugin.java.JavaPlugin plugin, DeepCoreLogger log, Supplier<List<org.bukkit.entity.Player>> onlineParticipantsSupplier) Creates a run-save vote service.- Parameters:
plugin- plugin instance for scheduling taskslog- logger for vote progress and timeout messagesonlineParticipantsSupplier- supplier for currently online participants
-
-
Method Details
-
castVote
Records a vote from the given player and triggers the save callback when all online participants have voted.- Parameters:
voter- player casting the voteonAllVoted- runnable executed when unanimous vote is reached- Returns:
- false if the player already voted or is not a participant
-
clearVotes
public void clearVotes()Cancels any pending vote and clears all recorded votes.
-