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 Details

    • createBossBar

      BossBar 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.
      Parameters:
      title - Title to display, supports placeholders
      progress - Progress to use. Must be between 0 and 100
      color - Color to use
      style - Style to use
      Returns:
      The newly created BossBar
    • createBossBar

      BossBar 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.
      Parameters:
      title - Title to display, supports placeholders
      progress - Progress to use. Must be a string version of a number, or a placeholder that returns a number
      color - Color to use. Must be a string version of one of enum constants, or a placeholder that returns one of them
      style - 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

      BossBar getBossBar(String name)
      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 using BossBar.getName(). Returns null if no such BossBar exists.
      Parameters:
      name - Name of registered BossBar
      Returns:
      BossBar with specified name
    • getBossBar

      BossBar getBossBar(UUID id)
      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

      Map<String,BossBar> 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

      void toggleBossBar(TabPlayer player, boolean sendToggleMessage)
      Toggles BossBar for this player and sends toggle message if sendToggleMessage is true.
      Parameters:
      player - Player to toggle BossBar for
      sendToggleMessage - true if toggle message should be sent, false if not
      See Also:
    • hasBossBarVisible

      boolean hasBossBarVisible(TabPlayer player)
      Returns true if player can see BossBars, false if toggled via command or API.
      Parameters:
      player - Player to check toggle status of
      Returns:
      true if visible, false if disabled (toggled)
      See Also:
    • setBossBarVisible

      void setBossBarVisible(TabPlayer player, boolean visible, boolean sendToggleMessage)
      Sets BossBar visibility of player to set value. If value did not change, nothing happens. If visibility changed, toggle message is sent if sendToggleMessage is true.
      Parameters:
      player - Player to set BossBar visibility of
      visible - true if BossBar should be visible, false if not
      sendToggleMessage - true if toggle message should be sent if value changed, false if not
      See Also:
    • sendBossBarTemporarily

      void sendBossBarTemporarily(TabPlayer player, String bossBar, int duration)
      Temporarily displays registered BossBar to player for specified amount of time in milliseconds.
      Parameters:
      player - Player to show BossBar to
      bossBar - Name of registered BossBar to show
      duration - In milliseconds for how long should BossBar be displayed
      Throws:
      IllegalArgumentException - if no BossBar with specified name exists
      See Also:
    • announceBossBar

      void announceBossBar(String bossBar, int duration)
      Temporarily displays registered BossBar to all players for specified amount of time in milliseconds.
      Parameters:
      bossBar - Name of registered BossBar to show
      duration - In milliseconds for how long should BossBar be displayed
      Throws:
      IllegalArgumentException - if no BossBar with specified name exists
      See Also:
    • getAnnouncedBossBars

      List<BossBar> getAnnouncedBossBars()
      Returns list of BossBars which are currently being announced.
      Returns:
      list of currently active BossBar announcements
      See Also: