/bossbar
This is an expansion to the /bossbar command which lets you link a score/stat value to the value of a bossbar. This allows you to dynamically change the value based on other conditions without needing to run a command every tick.
Target <Global>
This selector lets you attach it to both players and entities. But also fake players like: #world $value
This target is used in addition to the attached scoreboard to link a value to the bossbar.
Link | Unlink
Linking a scoreboard to a bossbar will replace the value with a score of your choice
Value will be disabled while a score is linked. Unlinking it will return the value Stat.
​
The score updated dynamically and does not need to be reapplied.
/bossbar set <id> score <link|unlink> <target> <scoreboard>
Syntax:
/bossbar set minecraft:test score link @n[type=giant] health
/bossbar set minecraft:test score link @s armor
/bossbar set minecraft:test score unlink