Package me.neznamy.tab.api.bossbar
Interface BossBarManager
public interface BossBarManager
An interface allowing work with BossBars such as creating, sending
and toggling.
Instance can be obtained using TabAPI.getBossBarManager().
This requires the BossBar feature to be enabled in config, otherwise the method will
return null.
-
Method Summary
Modifier and TypeMethodDescriptionvoidannounceBossBar(String bossBar, int duration) Temporarily displays registered BossBar to all players for specified amount of time in milliseconds.createBossBar(String title, float progress, BarColor color, BarStyle style) Creates BossBar with specified parameters and registers it to BossBar manager, allowing to retrieve it later.createBossBar(String title, String progress, String color, String style) Creates BossBar with specified parameters and registers it to BossBar manager, allowing to retrieve it later.Returns list of BossBars which are currently being announced.getBossBar(String name) Returns registered BossBar with given name.getBossBar(UUID id) Returns registered BossBar with specified UUID.Returns a map of all registered BossBars.booleanhasBossBarVisible(TabPlayer player) Returns true if player can see BossBars, false if toggled via command or API.voidsendBossBarTemporarily(TabPlayer player, String bossBar, int duration) Temporarily displays registered BossBar to player for specified amount of time in milliseconds.voidsetBossBarVisible(TabPlayer player, boolean visible, boolean sendToggleMessage) Sets BossBar visibility of player to set value.voidtoggleBossBar(TabPlayer player, boolean sendToggleMessage) Toggles BossBar for this player and sends toggle message ifsendToggleMessageis true.
-
Method Details
-
createBossBar
Creates BossBar with specified parameters and registers it to BossBar manager, allowing to retrieve it later.- Parameters:
title- Title to display, supports placeholdersprogress- Progress to use. Must be between 0 and 100color- Color to usestyle- Style to use- Returns:
- The newly created BossBar
-
createBossBar
Creates BossBar with specified parameters and registers it to BossBar manager, allowing to retrieve it later.- Parameters:
title- Title to display, supports placeholdersprogress- Progress to use. Must be a string version of a number, or a placeholder that returns a numbercolor- Color to use. Must be a string version of one of enum constants, or a placeholder that returns one of themstyle- Style to use. Must be a string version of one of enum constants, or a placeholder that returns one of them- Returns:
- The newly created BossBar
-
getBossBar
Returns registered BossBar with given name. For BossBars from config it is the name they were created with, for API BossBars their randomly generated name, which can be retrieved usingBossBar.getName(). Returns null if no such BossBar exists.- Parameters:
name- Name of registered BossBar- Returns:
- BossBar with specified name
-
getBossBar
Returns registered BossBar with specified UUID. This UUID is randomly generated when BossBar is created and used in packets / to match which the one from Bukkit API. Returns null if no such BossBar exists.- Parameters:
id- UUID to return BossBar by- Returns:
- BossBar with specified uuid
-
getRegisteredBossBars
Returns a map of all registered BossBars. This includes both BossBars from config and those registered via API.Map key is BossBar's name available in
BossBar.getName(), map value is the BossBar interface.- Returns:
- all registered BossBars
-
toggleBossBar
Toggles BossBar for this player and sends toggle message ifsendToggleMessageis true.- Parameters:
player- Player to toggle BossBar forsendToggleMessage-trueif toggle message should be sent,falseif not- See Also:
-
hasBossBarVisible
Returns true if player can see BossBars, false if toggled via command or API.- Parameters:
player- Player to check toggle status of- Returns:
trueif visible,falseif disabled (toggled)- See Also:
-
setBossBarVisible
Sets BossBar visibility of player to set value. If value did not change, nothing happens. If visibility changed, toggle message is sent ifsendToggleMessageistrue.- Parameters:
player- Player to set BossBar visibility ofvisible-trueif BossBar should be visible,falseif notsendToggleMessage-trueif toggle message should be sent if value changed,falseif not- See Also:
-
sendBossBarTemporarily
Temporarily displays registered BossBar to player for specified amount of time in milliseconds.- Parameters:
player- Player to show BossBar tobossBar- Name of registered BossBar to showduration- In milliseconds for how long should BossBar be displayed- Throws:
IllegalArgumentException- if no BossBar with specified name exists- See Also:
-
announceBossBar
Temporarily displays registered BossBar to all players for specified amount of time in milliseconds.- Parameters:
bossBar- Name of registered BossBar to showduration- In milliseconds for how long should BossBar be displayed- Throws:
IllegalArgumentException- if no BossBar with specified name exists- See Also:
-
getAnnouncedBossBars
Returns list of BossBars which are currently being announced.- Returns:
- list of currently active BossBar announcements
- See Also:
-