Package dev.deepcore.challenge.session
Class PrepCountdownService
java.lang.Object
dev.deepcore.challenge.session.PrepCountdownService
Manages the prep-phase ready countdown task lifecycle.
-
Constructor Summary
ConstructorsConstructorDescriptionPrepCountdownService(org.bukkit.plugin.java.JavaPlugin plugin) Creates a prep countdown service. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the active countdown task if one is currently running.voidstartCountdown(int countdownSeconds, BooleanSupplier shouldCancel, Runnable onCancel, Runnable onComplete, IntConsumer onTick) Starts the prep countdown with tick, cancel, and completion callbacks.
-
Constructor Details
-
PrepCountdownService
public PrepCountdownService(org.bukkit.plugin.java.JavaPlugin plugin) Creates a prep countdown service.- Parameters:
plugin- plugin used to schedule countdown tasks
-
-
Method Details
-
startCountdown
public void startCountdown(int countdownSeconds, BooleanSupplier shouldCancel, Runnable onCancel, Runnable onComplete, IntConsumer onTick) Starts the prep countdown with tick, cancel, and completion callbacks.- Parameters:
countdownSeconds- initial countdown duration in secondsshouldCancel- predicate checked each tick for cancellation conditionsonCancel- callback executed when countdown is canceledonComplete- callback executed when countdown reaches zeroonTick- callback receiving each second remaining value
-
cancel
public void cancel()Cancels the active countdown task if one is currently running.
-