Interface BossBar
For clients 1.8 and lower it uses wither, which only allows 1 bar to be displayed at a time. Entity packets are not available on BungeeCord, where nothing will be displayed for these players.
For 1.9+ it uses the new BossBar feature, allowing configurable styles and colors, as well as display several bars at once. Limit of maximum displayed BossBars depends on client resolution and GUI scale, up to 9 concurrent BossBars displayed at once.
-
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters this BossBar to specified player.booleancontainsPlayer(TabPlayer player) Returnstrueif specified player can see this BossBar,falseif notgetColor()Returns color of the BossBar as a string, which is either entered string containing placeholders or entered enum value converted to stringgetName()Returns name of this BossBar.Returns list of players who can see this BossBar.Returns progress of the BossBar as a string, which is either entered string containing placeholders or entered number converted to stringgetStyle()Returns style of the BossBar as a string, which is either entered string containing placeholders or entered enum value converted to stringgetTitle()Returns current title of the BossBar in raw format.Returns randomly generated uuid of this BossBar used internally to match the BossBar in client with packets or with Bukkit API BossBar instances.voidremovePlayer(TabPlayer player) Unregisters this BossBar from specified player.voidChanges BossBar color to specified string, supporting placeholders.voidChanges BossBar color to specified enum constant.voidsetProgress(float progress) Changes BossBar progress to specified value ranging from 0 to 100.voidsetProgress(String progress) Changes BossBar progress to specified string, supporting placeholders.voidChanges BossBar style to specified string, supporting placeholders.voidChanges BossBar style to specified enum constant.voidChanges BossBar title to specified string, supporting placeholders.
-
Method Details
-
getName
String getName()Returns name of this BossBar. If it was defined in config, returns the name specified in config. If it was made using the API, returns randomly generated ID given to this BossBar when creating.- Returns:
- name of BossBar
-
getUniqueId
UUID getUniqueId()Returns randomly generated uuid of this BossBar used internally to match the BossBar in client with packets or with Bukkit API BossBar instances.- Returns:
- uuid of this BossBar
-
setTitle
Changes BossBar title to specified string, supporting placeholders.If title contains new placeholders not used before, they are registered using standard registration logic and refreshed periodically. No need to call this method to try to keep placeholder values up to date.
If specified title is equal to the current one, nothing happens.
- Parameters:
title- New title to display in this BossBar
-
setProgress
Changes BossBar progress to specified string, supporting placeholders. The string must be a string version of a float value, or a placeholder that outputs a float value with range 0-100.If progress contains new placeholders not used before, they are registered using standard registration logic and refreshed periodically. No need to call this method to try to keep placeholder values up to date.
If specified progress is equal to the current one, nothing happens.
- Parameters:
progress- New progress to use in this BossBar
-
setProgress
void setProgress(float progress) Changes BossBar progress to specified value ranging from 0 to 100.If specified progress is equal to the current one, nothing happens.
- Parameters:
progress- New progress to use in this BossBar
-
setColor
Changes BossBar color to specified string, supporting placeholders. The string must be a string version of one of the supported values, or a placeholder that outputs one of them.If color contains new placeholders not used before, they are registered using standard registration logic and refreshed periodically. No need to call this method to try to keep placeholder values up to date.
If specified color is equal to the current one, nothing happens.
- Parameters:
color- New color to use in this BossBar
-
setColor
Changes BossBar color to specified enum constant.If specified color is equal to the current one, nothing happens.
- Parameters:
color- New color to use in this BossBar
-
setStyle
Changes BossBar style to specified string, supporting placeholders. The string must be a string version of one of the supported values, or a placeholder that outputs one of them.If style contains new placeholders not used before, they are registered using standard registration logic and refreshed periodically. No need to call this method to try to keep placeholder values up to date.
If specified style is equal to the current one, nothing happens.
- Parameters:
style- New style to use in this BossBar
-
setStyle
Changes BossBar style to specified enum constant.If specified style is equal to the current one, nothing happens.
- Parameters:
style- New style to use in this BossBar
-
getTitle
String getTitle()Returns current title of the BossBar in raw format. If it contains placeholders, their raw identifiers are used in the result.- Returns:
- title of the BossBar
-
getProgress
String getProgress()Returns progress of the BossBar as a string, which is either entered string containing placeholders or entered number converted to string- Returns:
- entered progress as a string
-
getColor
String getColor()Returns color of the BossBar as a string, which is either entered string containing placeholders or entered enum value converted to string- Returns:
- entered color as a string
-
getStyle
String getStyle()Returns style of the BossBar as a string, which is either entered string containing placeholders or entered enum value converted to string- Returns:
- entered style as a string
-
addPlayer
Registers this BossBar to specified player.If the player already sees this BossBar, nothing happens.
- Parameters:
player- Player to register this BossBar to
-
removePlayer
Unregisters this BossBar from specified player.If the player does not see this BossBar, nothing happens.
- Parameters:
player- Player to unregister this BossBar from
-
getPlayers
Returns list of players who can see this BossBar.The returned list can only be used to read. Writing will not work properly. For adding/removing players see
addPlayer(TabPlayer)andremovePlayer(TabPlayer).- Returns:
- List of players seeing this BossBar
-
containsPlayer
Returnstrueif specified player can see this BossBar,falseif not- Parameters:
player- Player to check for- Returns:
trueif contains,falseif not
-