How to run a function after a delay in Minecraft
Type /schedule function mypack:countdown 10s in chat as an operator to run that function in 10 seconds. /schedule clear cancels it.
schedule
Runs a function after a delay in ticks, seconds or in-game days, or cancels a scheduled function.
/schedule <function <function> <time> [append|replace]|clear <function>> Examples
/schedule function mypack:countdown 10s Runs the function in 10 seconds.
/schedule function mypack:loop 1t append Queues another run next tick.
/schedule clear mypack:countdown Cancels the pending run.
Arguments
functionRequired- Function ID or
#tag. timeOptional- Delay: ticks, or a value with
t,sord. append|replaceOptional- Add another run or replace the pending one. Defaults to
replace.
What it does
The time accepts ticks (20t or 20), seconds (10s) or days (1d). By default a new schedule for the same function replaces the old one; append queues it in addition. Scheduled functions run as the server at the world spawn, not as the player who scheduled them.
Good to know
- Needs operator permission level 2.
- The delay counts game ticks, so it pauses while the game is frozen with
tick freeze.
Run it on your server
On a SLASHPLAY server, type it in the Console tab without the leading slash; in game, operators type it in chat with the slash. New to this? Start a Minecraft server first.
Your own
Minecraft server.
From $0.03 an hour, only while it runs. New accounts get 6 free tokens.