Commands/bossbar

From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.
bossbar
Restrictions

Operator

Creates and modifies boss bars.

Syntax[edit]

bossbar add <id> <name>
Create a new boss bar.
bossbar get <id> (max|players|value|visible)
Return the requested setting as a result of the command.
bossbar list
Display a list of existing boss bars.
bossbar remove <id>
Remove an existing bossbar.
bossbar set <id> (color|max|name|players|style|value|visible)
... color (blue|green|pink|purple|red|white|yellow)
Set the text color (if no color was specified as part of a text component) and bar color. Defaults to white upon creation.
... max <max>
Set the boss bar's maximum value. Defaults to 100 upon creation.
... name <name>
Set the boss bar's name.
... players [<targets>]
Change the set of players to whom the bar is visible. Defaults to none upon creation.
... style (notched_6|notched_10|notched_12|notched_20|progress)
Set the boss bar's visual amount of segments: continuous, 6 segments, 10 segments, 12 segments, or 20 segments. Defaults to progress upon creation.
... value <value>
Set the boss bar's current value. Defaults to 0 upon creation.
... visible <visible>
Set the boss bar's visibility. Defaults to true upon creation.

Arguments[edit]

<id>: resource_location

Must be a namespaced ID.
Specifies a unique boss bar.

<name>: component

Must be a raw JSON text.
Specifies the display name of the boss bar.

<max>: integer

Must be a 32-bit integer number. And it must be between 1 and 2147483647 (inclusive).
Specifies the boss bar's maximum value.

<targets>: entity

Must be a player name, a target selector or a UUID. And the target selector must be of player type.
Specifies the set of players to whom the bar is visible

<value>: integer

Must be a 32-bit integer number. And it must be between 0 and 2147483647 (inclusive).
Specifies the boss bar's current value.

<visible>: bool

Must be a boolean (either true or false).
Specifies the boss bar's visibility.

Result[edit]

CommandTriggerJava Edition
anythe arguments are not specified correctly Unparseable
/bossbar set ...
/bossbar remove ...
/bossbar get
if specified boss bar doesn't exist Failed
/bossbar add ...if a boss bar with specified id have already existed
/bossbar set ...if the boss bar's property have already been the same as the specified value
anyOn successCreates, modifies or lists boss bar(s).

Output[edit]

CommandEditionSituationSuccess Count/execute store succeess .../execute store result ...
anyJava EditionOn fail000
/bossbar add ...
/bossbar list
/bossbar remove ...
On success11The number of custom bosbars that exist after the command is executed.
Bosbars created by the game (such as the boss bar of the ender dragon) isn't included.
/bossbar get <id> max
/bossbar set <id> max
On success11The boss bar's maximum value after the command is executed.
/bossbar get <id> value
/bossbar set <id> value
On success11The boss bar's value after the command is executed.
/bossbar get <id> players
/bossbar set <id> players
On success11The number of players to whom the bar is visible after the command is executed.
/bossbar get <id> visibleOn success111 if the boss bar is visible; otherwise 0.
/bossbar set <id> color
/bossbar set <id> name
/bossbar set <id> style
/bossbar set <id> visible
On success110

History[edit]

Java Edition
1.1318w05aAdded bossbar