Repository navigation
Triggers
A trigger starts or ends a timer from something that happens in the world, instead of from a command.
Every trigger says which of the two it does. A timer can have as many as you like on each side.
/timer trigger event add player_death finish
/timer trigger event add dimension_change minecraft:the_nether start
/timer trigger event list
/timer trigger event remove 1
/timer trigger event clear
| Kind | Fires when | Needs |
|---|---|---|
player_join |
somebody is online | — |
player_leave |
somebody leaves | — |
player_death |
somebody dies | — |
player_respawn |
somebody respawns | — |
dimension_change |
somebody is in a dimension | the dimension id |
advancement |
somebody holds an advancement | the advancement id |
ftb_quest |
a quest has been completed | the quest id |
ftb_reward |
a reward has been claimed | the reward id |
scoreboard |
a score reaches a value | objective and number |
expression |
an expression is true | the expression |
ftb_quest and ftb_reward need FTB Quests installed — see
FTB Quests Integration. expression is the boolean language described in
Expressions.
The kinds fall into two groups, and the difference matters as soon as you combine them.
Some are states. Being in a dimension, holding an advancement, having completed a quest, being online, a score being above a number. These are asked about, and they are true for as long as they are true. Leave the Nether and "is in the Nether" stops being true.
Some are moments. Leaving, dying, respawning. Nothing is left behind to ask about afterwards, so they are true for the single instant they are read.
This is why "in the Nether and in the End" cannot be satisfied by one player visiting both in turn: by the time they reach the End they are no longer in the Nether. And it is why two moments in one combination have to happen in the same tick — two players dying a second apart is not two deaths at once.
Every trigger names the players it applies to, and how many of them it takes.
How many:
| Meaning | |
|---|---|
any |
one of them is enough |
all |
every one of them |
at_least <n> |
at least that many |
Who:
| Meaning | |
|---|---|
audience |
whoever the timer's execution is for |
everyone |
anybody on the server |
players <names> |
a comma-separated list |
selector <selector> |
@a[team=red] and the like |
/timer trigger event add scoreboard kills 10 finish all players Bob,Ann
/timer trigger event add dimension_change minecraft:the_nether finish at_least 3 selector @a[team=red]
The default, when you leave it out, is any of the timer's own audience.
A timer's start side and finish side are each a list of alternatives. Any one alternative being satisfied is enough.
Inside an alternative, everything has to hold at once.
Starts it when...
├─ all of these hold at once
│ ├─ A player is in a dimension (minecraft:the_nether) · all of these players: red team
│ └─ A player is in a dimension (minecraft:the_end) · all of these players: blue team
or
└─ A score reaches a value (ready ≥ 2) · any of anybody on the server
That reads: start the round when the red team is in the Nether and the blue
team is in the End at the same moment — or, failing that, when the ready
score reaches 2.
Building this is far easier in the Admin Panel, which draws the tree and asks one question at a time. The commands can do it too, one condition per command, and the panel is where they are combined.
Every tick, and only while the trigger can do anything:
- A start trigger is watched while the timer is not running.
- A finish trigger is watched while it is.
A trigger never fires on the tick it starts being watched. Whatever was already true at that moment is the baseline, not a reason — otherwise arming a timer whose condition already held would fire it immediately, for ever.
In earlier versions these were two separate systems. They are one now: a
condition is a trigger with an expression or scoreboard kind. Everything
lives under /timer trigger.