/bossbar
< Commands
This article is about the command. For the HUD element, see Bossbar.
This feature is exclusive to Java Edition.
/bossbar| Permission level required |
2 |
|---|---|
| Restrictions |
None |
{
"title": "<code>/bossbar</code>",
"rows": [
{
"field": "2",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "None",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
Creates, modifies and lists bossbars.
Syntax
bossbar add <id> <name>- Create a new bossbar (stored in level.dat
CustomBossEvents).
- Create a new bossbar (stored in level.dat
bossbar get <id> (max|players|value|visible)- Return the requested setting as a
resultof the command.
- Return the requested setting as a
bossbar list- Display a list of existing bossbars.
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
whiteupon creation.
- Set the text color (if no color was specified as part of a text component) and bar color. Defaults to
... max <max>- Set the bossbar's maximum value. Defaults to
100upon creation.
- Set the bossbar's maximum value. Defaults to
... name <name>- Set the bossbar'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 bossbar's visual amount of segments: continuous, 6 segments, 10 segments, 12 segments, or 20 segments. Defaults to
progressupon creation.
- Set the bossbar's visual amount of segments: continuous, 6 segments, 10 segments, 12 segments, or 20 segments. Defaults to
... value <value>- Set the bossbar's current value. Defaults to
0upon creation.
- Set the bossbar's current value. Defaults to
... visible <visible>- Set the bossbar's visibility. Defaults to
trueupon creation.
- Set the bossbar's visibility. Defaults to
Arguments
<id>: resource_location
- Specifies a unique bossbar.
- Must be a resource location for an unregistered content.
<name>: component
- Specifies the display name of the bossbar.
- It must be a valid text component.
<max>: integer
- Specifies the bossbar's maximum value.
- Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). And it must be between 1 and 2147483647 (inclusive).
<targets>: entity
- Specifies the set of players to whom the bar is visible.
- If not specified, the boss bar is invisible to any player.
- Must be a player name, a target selector or a UUID. And the target selector must be of player type.
<value>: integer
- Specifies the bossbar's current value.
- Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). And it must be between 0 and 2147483647 (inclusive).
<visible>: bool
- Specifies the bossbar's visibility.
- Must be a [Boolean]Boolean (either
trueorfalse).
Result
| Command | Trigger | Java Edition |
|---|---|---|
| Any | The command is incomplete, or any argument is not specified correctly. | Unparseable |
/bossbar set ... | The specified boss bar doesn't exist. | Failed |
/bossbar add ... | A boss bar with specified id have already existed. | |
/bossbar set ... | The boss bar's property has already been the same as the specified value. | |
| Any | Otherwise | Successful |
Output
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| Any | Java Edition | On fail | 0 | 0 | 0 |
/bossbar add ... | On success | 1 | 1 | The number of custom bossbars that exist after the command is executed. Bossbars created by the game itself (such as the boss bar of the ender dragon) aren't included. | |
/bossbar get <id> max | On success | 1 | 1 | The boss bar's maximum value after the command's execution. | |
/bossbar get <id> value | On success | 1 | 1 | The boss bar's value after execution. | |
/bossbar get <id> players | On success | 1 | 1 | The number of players to whom the bar is visible after execution. | |
/bossbar get <id> visible | On success | 1 | 1 | 1 if the boss bar is visible; otherwise 0. | |
/bossbar set <id> color | On success | 1 | 1 | 0 |
History
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.13 | 18w05a | Added bossbar. | |||||
| 1.21.5 | 25w05a | Text component arguments are now resolved before use in context of entity held in @s. | |||||