Countdown
Countdown is the “final-N-seconds” chat countdown that every minigame eventually writes. It formats a single chat line per second and plays a note-block click — and that’s it. The phase orchestrator owns the “remaining seconds” count; Countdown just knows how to format and play.
When to use it
Section titled “When to use it”- A phase has 10 seconds left and you want a chat-driven countdown that all players see.
- You want the standard “click + line per second” feel without copying the pattern across mods.
- You want to delegate the click sound to the engine’s
Effects.countdownTick.
package me.zlex.conduit.chat;
public final class Countdown { public static boolean shouldTick(int remainingSeconds, int finalN); public static void tick(Collection<ServerPlayer> players, int remainingSeconds, String prefix, String suffix); public static void tickDefault(Collection<ServerPlayer> players, int remainingSeconds);}shouldTick returns true when remainingSeconds is in [1..finalN] — call it once per second from your phase’s tick handler.
Example
Section titled “Example”import me.zlex.conduit.chat.Countdown;import net.minecraft.server.level.ServerPlayer;
public final class SprintRaceRound {
private int secondsLeft = 60;
public void onSecondTick(Collection<ServerPlayer> players) { secondsLeft--;
if (Countdown.shouldTick(secondsLeft, 10)) { Countdown.tick(players, secondsLeft, "§e", "§r seconds — run!"); }
if (secondsLeft <= 0) endRound(players); }}tickDefaultis shorthand for the default “§eN§r seconds remaining” format if you don’t need to customise the text.- The tick sound is
Effects.countdownTick, which plays a note-block bit at each recipient’s location. - This helper doesn’t own the timer — you do. It just handles the formatting + audio side.