utilityIntermediatenewmc 1.20.x – 1.21.x39 lines
cooldown helper functions
drop-in cooldown functions for any command. setCooldown(player, key, seconds) / onCooldown(player, key) / cooldownLeft(player, key). auto-formats remaining time as 'Xm Ys'.
vanilla Skriptno addons required.
cooldown-helper.sk39 lines
# Reusable cooldown helpers — call from any command to add a cooldown # with formatted remaining-time messages. No more hand-rolled # 'difference between {cd::%player%} and now' boilerplate. # # Usage: # command /heal: # trigger: # if onCooldown(player, "heal") is true: # send "&cWait %cooldownLeft(player, \"heal\")%" to player # stop # setCooldown(player, "heal", 30) # heal player function setCooldown(p: player, key: string, seconds: number): set {cooldowns::%uuid of {_p}%::%{_key}%} to (now + {_seconds} seconds) function onCooldown(p: player, key: string) :: boolean: if {cooldowns::%uuid of {_p}%::%{_key}%} is not set: return false return {cooldowns::%uuid of {_p}%::%{_key}%} > now function cooldownLeft(p: player, key: string) :: string: if {cooldowns::%uuid of {_p}%::%{_key}%} is not set: return "ready" if {cooldowns::%uuid of {_p}%::%{_key}%} <= now: return "ready" set {_diff} to difference between now and {cooldowns::%uuid of {_p}%::%{_key}%} return "%{_diff}%" function clearCooldown(p: player, key: string): delete {cooldowns::%uuid of {_p}%::%{_key}%} # Optional: periodically prune expired entries so the variable file stays small every 5 minutes: loop {cooldowns::*}: loop {cooldowns::%loop-index-1%::*}: if {cooldowns::%loop-index-1%::%loop-index-2%} <= now: delete {cooldowns::%loop-index-1%::%loop-index-2%}
get it running
cooldown-helper.sk · 39 lines · vanilla Skript- 1
copy or download
grab the .sk file with the buttons up top.
cooldown-helper.sk· ready to drop in - 2
drop it in your scripts folder
save it exactly here on your server — no typos, just copy the path:
…/plugins/Skript/scripts/cooldown-helper.sk - 3
reload in-game
run this in chat or console — your script goes live instantly:
/sk reload cooldown-helper
that's it — your script is live. hop in-game to try it.
/ related templates
more utility templates
utility
afk detector
marks a player as afk after 5 minutes of no movement. announces when they go afk and return.
utilitytop players leaderboard (/top)
tracks player kills. /top shows the top 10 in chat. auto-updates as players kill mobs.
utilitytrash can gui (/trash)
opens a single-row chest the player can dump unwanted items into. contents discarded on close.