Bossbars and titles: persistent state, timings, and the value/max split
A bossbar survives restarts and a title does not. Here is the create-then-modify pattern, the fade timings people set backwards, and how to drive a progress bar.
Both draw text on screen and that is where the similarity ends. Titles are fire-and-forget; bossbars are persistent objects you have to manage.
Bossbars are stateful
/bossbar add my:timer {"text":"Time left"}
/bossbar set my:timer players @a
/bossbar set my:timer max 600
/bossbar set my:timer value 600
/bossbar set my:timer color red
/bossbar set my:timer style notched_10
An id, then commands that modify it. Points people trip on:
- The bar is invisible until it has players. Creating one and never running
set ... players produces nothing, with no error.
- It persists in the world save. A bar created for a minigame is still there next
session. /bossbar remove when finished, or they accumulate.
valueandmaxare separate, and the bar showsvalue / max. Setting only
value on a bar whose max is still 100 gives nonsense fill.
Colours: pink white red orange yellow green blue purple. Styles: progress notched_6 notched_10 notched_12 notched_20.
Driving a countdown
/bossbar set my:timer value 599
once per second from a repeating function is the whole mechanism. There is no built-in timer. Reading it back is useful too:
/execute store result score @s Left run bossbar get my:timer value
bossbar get supports value, max, players and visible, which makes a bossbar a workable global variable when you want the player to see it.
Titles are transient
/title @a times 10 70 20
/title @a subtitle {"text":"Get ready"}
/title @a title {"text":"Round 2"}
Three things in that order, and the order matters:
timesfirst. Setting it after the title has no effect on the title already shown.subtitlebeforetitle. The subtitle alone displays nothing; sending the title
is what triggers the pair to appear. Reversed, the first one shows with no subtitle.
times is fadeIn stay fadeOut in ticks — 20 ticks per second. 10 70 20 is half a second in, three and a half held, one out. People set 1 1 1 and wonder why nothing appears: three ticks total is a flash.
actionbar is separate
/title @a actionbar {"text":"Saved"}
The line above the hotbar. It ignores times entirely — it shows for a fixed couple of seconds and fades. Re-sending it every tick keeps it up permanently, which is the standard way to run a custom HUD.
Clearing
/title @a clear removes what is showing; /title @a reset also restores default timings. For bossbars, /bossbar set my:timer visible false hides without destroying state.
Build bossbar, title, and the rest of the control and debug commands from a form in the Advanced Command Builder — Control & Debug.