Interface BossBar


public interface BossBar
An interface representing a BossBar line.

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 Type
    Method
    Description
    void
    Registers this BossBar to specified player.
    boolean
    Returns true if specified player can see this BossBar, false if not
    Returns color of the BossBar as a string, which is either entered string containing placeholders or entered enum value converted to string
    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 string
    Returns style of the BossBar as a string, which is either entered string containing placeholders or entered enum value converted to string
    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.
    void
    Unregisters this BossBar from specified player.
    void
    Changes BossBar color to specified string, supporting placeholders.
    void
    Changes BossBar color to specified enum constant.
    void
    setProgress(float progress)
    Changes BossBar progress to specified value ranging from 0 to 100.
    void
    setProgress(String progress)
    Changes BossBar progress to specified string, supporting placeholders.
    void
    Changes BossBar style to specified string, supporting placeholders.
    void
    Changes BossBar style to specified enum constant.
    void
    Changes 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

      void setTitle(String title)
      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

      void setProgress(String progress)
      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

      void setColor(String color)
      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

      void setColor(BarColor color)
      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

      void setStyle(String style)
      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

      void setStyle(BarStyle style)
      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

      void addPlayer(TabPlayer player)
      Registers this BossBar to specified player.

      If the player already sees this BossBar, nothing happens.

      Parameters:
      player - Player to register this BossBar to
    • removePlayer

      void removePlayer(TabPlayer player)
      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

      List<TabPlayer> 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) and removePlayer(TabPlayer).

      Returns:
      List of players seeing this BossBar
    • containsPlayer

      boolean containsPlayer(TabPlayer player)
      Returns true if specified player can see this BossBar, false if not
      Parameters:
      player - Player to check for
      Returns:
      true if contains, false if not