Class RunSaveVoteService

java.lang.Object
dev.deepcore.challenge.session.RunSaveVoteService

public final class RunSaveVoteService extends Object
Collects unanimous player votes to save the current speedrun to disk.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RunSaveVoteService(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 Type
    Method
    Description
    boolean
    castVote(org.bukkit.entity.Player voter, Runnable onAllVoted)
    Records a vote from the given player and triggers the save callback when all online participants have voted.
    void
    Cancels any pending vote and clears all recorded votes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 tasks
      log - logger for vote progress and timeout messages
      onlineParticipantsSupplier - supplier for currently online participants
  • Method Details

    • castVote

      public boolean castVote(org.bukkit.entity.Player voter, Runnable onAllVoted)
      Records a vote from the given player and triggers the save callback when all online participants have voted.
      Parameters:
      voter - player casting the vote
      onAllVoted - 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.