Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/stopwatch

Command

/stopwatch

Creates, reads, restarts and removes named stopwatches that measure real time.

Syntax

/stopwatch (create <id>|remove <id>|restart <id>)
/stopwatch query <id> [<scale>]

Arguments

ArgumentKind of valueWhat to type
<id>IdThe name of the stopwatch, written as an id such as race or mypack:race. Without a namespace, minecraft is used.
<scale>Decimal numberA decimal number the elapsed seconds are multiplied by to form the number /execute store saves of query. Defaults to 1.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inSingleplayer with cheats enabled, multiplayer servers, command blocks and functions. Needs permission level 2 (gamemasters): operators, players in a world with cheats enabled, command blocks and functions.
Resultcreate reports "Created stopwatch '<id>'", restart reports "Restarted stopwatch '<id>'" and remove reports "Removed stopwatch '<id>'"; each returns 1. query reports "Stopwatch '<id>' has run for N s" and returns the elapsed seconds multiplied by the scale, cut down to a whole number.
createCreates a stopwatch with the given id and starts it at once. Fails with "Stopwatch '<id>' already exists" if the id is in use.
queryShows how many seconds the stopwatch has run. The optional scale multiplies the seconds for the number /execute store saves only: the default 1 returns whole seconds, 20 returns the time in ticks, 1000 returns milliseconds.
restartSets the stopwatch back to zero and lets it run on.
removeDeletes the stopwatch.
Unknown idquery, restart and remove fail with "Stopwatch '<id>' does not exist" if there is no stopwatch with that id.
Real timeStopwatches count real seconds, not game ticks, so they are not slowed down by lag or by /tick. They are stored with the world, and the time already counted is kept when the world is closed and reopened.

Examples

/stopwatch create race

Creates a stopwatch named race and starts it.

/stopwatch query race

Shows how many seconds the stopwatch race has run.

/stopwatch query race 20

Shows the time and returns it in ticks, for use with /execute store.

/stopwatch restart race

Sets the stopwatch race back to zero.

/stopwatch remove race

Deletes the stopwatch race.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)