Class BossbarManager
- All Implemented Interfaces:
Runnable,ChatPluginManager
Bossbars.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassTimer used to teleport the reflection bossbars' Withers. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBossbar(String id) Gets a bossbar fromgetBossbars()by its ID.Gets the list of loaded bossbars.Gets the list of enabled worlds.static BossbarManagerGets this manager's instance.longGets the last timerun()'s timer has been run, in milliseconds.longGets the timeout between sendings while loading the bossbar, in milliseconds.Gets the loading bossbars' tasks' map.Gets the list of placeholder types used to translateBossbar.getTitles().Gets the current reflection bossbar timer's instance.longGets theBossbarManager.ReflectionBossbarTimer.run()'s timer's task's ID.doubleGets the distance from the player to which the Wither will be teleported to when using reflection.longGets the timeout between Wither teleportations when using reflection, in milliseconds.longGets the timeout between sendings, in milliseconds.intGets therun()'s timer's index ofgetBossbars().longGets therun()'s timer's task's ID.booleanChecks if this manager is enabled.booleanChecks if an animation should be shown while loading the bossbar when a player joins.booleanChecks if the bossbars should be sent in a random order.booleanisValidBossbarID(String bossbarID) Checks if the specified String is a valid bossbar ID.booleanisWorldEnabled(String world) Checks if a world is contained in the enabled worlds' list.abstract voidrun()Automatic bossbar sender, called once everygetSendingTimeout()ms.abstract voidsendBossbar(Bossbar bossbar, ChatPluginServerPlayer player) Sends a bossbar to a loaded player.booleanChecks if bossbars' titles should be abbreviated by adding '…' at the end when they are too long to be displayed instead ofTITLE_TOO_LONG.booleanChecks if bossbars sent to legacy (pre-1.9) players should always be full.abstract voidstartLoading(ChatPluginServerPlayer player) Starts displaying the loading bossbar to the specified player.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.remigio07.chatplugin.api.common.util.manager.ChatPluginManager
checkAvailability, isReloadable, load, reload, unload
-
Field Details
-
BOSSBAR_ID_PATTERN
Pattern representing the allowed bossbar IDs.Regex:
^[a-zA-Z0-9-_]{2,36}$- See Also:
-
MAX_TITLE_LENGTH
public static final int MAX_TITLE_LENGTHValue representing the max title length.Value: 256 on > 1.12.2, 64 otherwise
-
TITLE_TOO_LONG
String containing the "title too long" text indicator.Content: "§cTitle exceeds §f+" +
MAX_TITLE_LENGTH+ " §cchars"- See Also:
-
-
Constructor Details
-
BossbarManager
public BossbarManager()
-
-
Method Details
-
isEnabled
public boolean isEnabled()Checks if this manager is enabled.Found at: "bossbars.settings.enabled" in
ConfigurationType.BOSSBARS- Specified by:
isEnabledin interfaceChatPluginManager- Returns:
- Whether this manager is enabled
-
isRandomOrder
public boolean isRandomOrder()Checks if the bossbars should be sent in a random order.Found at: "bossbars.settings.random-order" in
ConfigurationType.BOSSBARS- Returns:
- Whether to use a random order
-
shouldAbbreviateLongTitles
public boolean shouldAbbreviateLongTitles()Checks if bossbars' titles should be abbreviated by adding '…' at the end when they are too long to be displayed instead ofTITLE_TOO_LONG.Found at: "bossbars.settings.abbreviate-long-titles" in
ConfigurationType.BOSSBARS- Returns:
- Whether to abbreviate long titles
-
shouldSendFullToLegacyPlayers
public boolean shouldSendFullToLegacyPlayers()Checks if bossbars sent to legacy (pre-1.9) players should always be full.This is a workaround to prevent players from seeing invisible withers in the distance when the bossbar is <= 50%.
Found at: "bossbars.settings.send-full-to-legacy-players" in
ConfigurationType.BOSSBARS- Returns:
- Whether to send full bossbars to legacy players
-
isLoadingBossbarEnabled
public boolean isLoadingBossbarEnabled()Checks if an animation should be shown while loading the bossbar when a player joins.Found at: "bossbars.settings.loading-bossbar.enabled" in
ConfigurationType.BOSSBARS- Returns:
- Whether the loading bossbar is enabled
-
getReflectionWitherTeleportationDistance
public double getReflectionWitherTeleportationDistance()Gets the distance from the player to which the Wither will be teleported to when using reflection.Found at: "bossbars.settings.reflection-wither-teleportation.distance" in
ConfigurationType.BOSSBARS- Returns:
- Reflection Wither's teleportation distance
-
getReflectionWitherTeleportationTimeout
public long getReflectionWitherTeleportationTimeout()Gets the timeout between Wither teleportations when using reflection, in milliseconds.Found at: "bossbars.settings.reflection-wither-teleportation.timeout-ms" in
ConfigurationType.BOSSBARS- Returns:
- Time between reflection Wither's teleportations
-
getSendingTimeout
public long getSendingTimeout()Gets the timeout between sendings, in milliseconds.Found at: "bossbars.settings.sending-timeout-ms" in
ConfigurationType.BOSSBARS- Returns:
- Time between sendings
-
getLoadindBossbarSendingTimeout
public long getLoadindBossbarSendingTimeout()Gets the timeout between sendings while loading the bossbar, in milliseconds.Found at: "bossbars.settings.loading-bossbar.sending-timeout-ms" in
ConfigurationType.BOSSBARS- Returns:
- Time between sendings while loading the bossbar
-
getPlaceholderTypes
Gets the list of placeholder types used to translateBossbar.getTitles().Found at: "bossbars.settings.placeholder-types" in
ConfigurationType.BOSSBARS- Returns:
- Placeholders used to translate titles
-
getEnabledWorlds
Gets the list of enabled worlds.Bossbars only apply to their enabled worlds.
Found at: "bossbars.settings.enabled-worlds" in
ConfigurationType.BOSSBARS- Returns:
- Enabled worlds' list
-
isWorldEnabled
Checks if a world is contained in the enabled worlds' list.- Parameters:
world- Name of the world to check- Returns:
- Whether the world is enabled
-
getBossbars
Gets the list of loaded bossbars.You may modify the returned list.
- Returns:
- Loaded bossbars' list
-
getLoadingBossbarsTasks
Gets the loading bossbars' tasks' map.Do not modify the returned map.
- Returns:
- Loading bossbars' tasks' map
-
getBossbar
Gets a bossbar fromgetBossbars()by its ID.Will return
nullif the bossbar is not loaded.- Parameters:
id- Bossbar's ID, case insensitive- Returns:
- Loaded bossbar
-
getReflectionBossbarTimer
Gets the current reflection bossbar timer's instance.Will return
nullif reflection is not being used.- Returns:
- Current reflection bossbar timer's instance
-
getTimerTaskID
public long getTimerTaskID()Gets therun()'s timer's task's ID.You can interact with it using
TaskManager's methods.- Returns:
- Sending task's ID
-
getReflectionTimerTaskID
public long getReflectionTimerTaskID()Gets theBossbarManager.ReflectionBossbarTimer.run()'s timer's task's ID.You can interact with it using
TaskManager's methods.- Returns:
- Reflection timer's index
-
getTimerIndex
public int getTimerIndex()Gets therun()'s timer's index ofgetBossbars().- Returns:
- Timer's index
-
getLastRunTime
public long getLastRunTime()Gets the last timerun()'s timer has been run, in milliseconds.- Returns:
- Timer's last run time
-
isValidBossbarID
Checks if the specified String is a valid bossbar ID.- Parameters:
bossbarID- Bossbar ID to check- Returns:
- Whether the specified bossbar ID is valid
- See Also:
-
getInstance
Gets this manager's instance.- Returns:
- Manager's instance
-
run
public abstract void run()Automatic bossbar sender, called once everygetSendingTimeout()ms. -
sendBossbar
Sends a bossbar to a loaded player.It will not be sent if
Bossbar.isHidden().- Parameters:
bossbar- Bossbar to sendplayer- Player to send the bossbar to- See Also:
-
startLoading
Starts displaying the loading bossbar to the specified player.- Parameters:
player- Player to display the bossbar to
-