Cooldowns

Cooldowns use a scoreboard objective that decrements every tick. When the score reaches 0 the cooldown is ready. Durations are expressed as TimeNumber values - 2.seconds, 40.ticks, etc.

They are a good fit for abilities, interactions, item usage limits, or any mechanic that should be reusable for several players without hand-writing the decrement logic every time.

Footprint
  • Objectives: one per cooldown, named after it.
  • Storage: none.
  • Entities: none.
  • Forceloaded chunks: none.
  • Every tick: cooldown_<name>_tick removes 1 from every entity above 0.
  • Load and files: cooldown_<name>_init creates the objective. Each ifReady block becomes a cooldown_<name>_ready_<hash> function, listed in #kore:cooldown_ready_handlers.

Registering a cooldown

val cd = registerCooldown("attack_cd", 2.seconds)
Kotlin

This generates:

  • A load function that creates the scoreboard objective.
  • A tick function that decrements the score of every entity with a score ≥ 1, players or not.

Typical usage pattern

function("dash_skill") {
	with(cd) {
		ifReady(player) {
			say("Dash!")
		}
	}
}

function("dash_hit") {
	cd.start(player)
}
Kotlin

This split keeps the "can I use it?" check separate from the event or action that actually starts the cooldown.

Using a cooldown

function("combat") {
	with(cd) {
		start(player)               // sets the score to the duration
		ifReady(player) {           // runs only when score == 0, then restarts
			say("Attack ready!")
		}
		reset(player)               // forces score to 0
	}
}
Kotlin

Function reference

Function Description
start Set the entity score to the configured duration
ifReady Run a block only when the cooldown is ready
reset Force the cooldown back to 0
tick hook Auto-generated function that decrements active cooldown scores

See also

  • Timers - Use timers when you need scheduled callbacks rather than per-player readiness checks.
  • Events - Start or reset cooldowns from gameplay triggers such as clicks, kills, or item use.
  • State Delegates - Reduce scoreboard boilerplate in adjacent stateful systems.