Timers

Timers use a scoreboard objective that increments every tick. When the score reaches the configured duration, completion handlers fire.

This is a strong fit for round timers, capture phases, delayed rewards, warmups, or any mechanic that should complete after a predictable amount of ticks.

Registering a timer

val timer = registerTimer("round_timer", 5.seconds)
Kotlin

This generates:

  • A load function that creates the scoreboard objective.
  • A tick function that increments the score for all players with score ≥ 0.

Typical lifecycle

function("round_start") {
	timer.start(player)
}

function("round_cancel") {
	timer.stop(player)
}
Kotlin

Using dedicated start and stop points keeps it clear which gameplay events begin or cancel the countdown.

Using a timer

function("round") {
	with(timer) {
		start(player)
		onComplete(player) {
			say("Time's up!")
		}
		stop(player)
	}
}
Kotlin
Function Description
start Set the score to 0, beginning the countdown
stop Set the score to −1, halting the timer
onComplete Register a handler that fires when duration is reached

Timer with Boss Bar

Combines a timer with an auto-managed boss bar:

val timedBar = registerTimerWithBossBar("boss_timer", 10.seconds) {
	color = BossBarColor.GREEN
	style = BossBarStyle.NOTCHED_20
}

function("boss_round") {
	with(timedBar) {
		start(player)
		onComplete(player) { say("Boss round over!") }
		stop(player)
	}
}
Kotlin

The boss-bar variant is useful when you want a countdown that is both mechanical and visible to players without having to manually synchronize a separate UI layer.