Interface ScoreboardManager


public interface ScoreboardManager
Interface allowing work with scoreboards, such as creating, sending, toggling and modifying.

Instance can be obtained using TabAPI.getScoreboardManager(). This requires the scoreboard feature to be enabled in config, the method will return null otherwise.

  • Method Details

    • createScoreboard

      Scoreboard createScoreboard(String name, String title, List<String> lines)
      Creates new scoreboard, registers and returns it. name is internal name of the scoreboard, which it will be registered with and further work where scoreboard name is used allowed.

      Scoreboard title is limited to 32 characters on <1.13. If needed, it will be cut to 32 character for those players (after replacing placeholders). RGB is supported using any of the supported formats. Placeholders are supported.

      lines will display in the same order as contained in the list. Client can only see up to 15 lines at a time, however you can define more, if some of them only consist of placeholder that might be empty.

      Parameters:
      name - Internal name of the scoreboard
      title - The scoreboard title
      lines - Lines of text in scoreboard (supports placeholders)
      Returns:
      The new scoreboard with given parameters
      Throws:
      NullPointerException - if name or lines is null
    • getRegisteredScoreboards

      Map<String,Scoreboard> getRegisteredScoreboards()
      Returns map of registered scoreboards via config and API. Map key is name of scoreboard, which is defined either in config or using createScoreboard(String, String, List). Map value is reference to the actual scoreboard.
      Returns:
      map of registered scoreboards
    • showScoreboard

      void showScoreboard(TabPlayer player, Scoreboard scoreboard)
      Displays scoreboard to defined player. This will disable all display condition checks until the scoreboard is unregistered using resetScoreboard(TabPlayer). If the player already sees this scoreboard, nothing will happen.
      Parameters:
      player - Player to send scoreboard to
      scoreboard - Scoreboard to display
      Throws:
      NullPointerException - if player or scoreboard is null
      See Also:
    • hasCustomScoreboard

      boolean hasCustomScoreboard(TabPlayer player)
      Returns true if player has custom scoreboard set using showScoreboard(TabPlayer, Scoreboard), false if not.
      Parameters:
      player - Player to check
      Returns:
      true if player has custom scoreboard set using API, false if not
      See Also:
    • resetScoreboard

      void resetScoreboard(TabPlayer player)
      Hides custom scoreboard sent using showScoreboard(TabPlayer, Scoreboard) and re-enables internal display logic with conditions. If player does not have any forced scoreboard, nothing happens.
      Parameters:
      player - Player to hide custom scoreboard from
      See Also:
    • hasScoreboardVisible

      boolean hasScoreboardVisible(TabPlayer player)
      Returns true if player has scoreboard enabled, false if disabled (toggled) using either toggle command, toggleScoreboard(TabPlayer, boolean) or setScoreboardVisible(TabPlayer, boolean, boolean).
      Parameters:
      player - Player to get visibility status of
      Returns:
      true if visible, false if disabled
      See Also:
    • setScoreboardVisible

      void setScoreboardVisible(TabPlayer player, boolean visible, boolean sendToggleMessage)
      Sets scoreboard visibility of player to defined value. If visibility status is same as player had before, nothing happens. If this call changes visibility, scoreboard is toggled. If sendToggleMessage is true, toggle message defined in configuration is sent.
      Parameters:
      player - Player to set visibility for
      visible - New visibility status
      sendToggleMessage - whether to send toggle message if status changed or not
      See Also:
    • toggleScoreboard

      void toggleScoreboard(TabPlayer player, boolean sendToggleMessage)
      Toggles scoreboard for specified player. If player had scoreboard visible, hides it. If hidden, shows it. If sendToggleMessage is true, toggle message defined in configuration is sent.
      Parameters:
      player - Player to toggle scoreboard for
      sendToggleMessage - Whether to send toggle message or not
      See Also:
    • announceScoreboard

      void announceScoreboard(String scoreboard, int duration)
      Temporarily displays scoreboard to all players for specified amount of time (in milliseconds). Scoreboard name is either defined in config, or through API in createScoreboard(String, String, List).
      Parameters:
      scoreboard - Scoreboard from config or registered via API
      duration - Duration in milliseconds
      Throws:
      IllegalArgumentException - if no scoreboard was found with such name or duration is < 0.
    • getActiveScoreboard

      Scoreboard getActiveScoreboard(TabPlayer player)
      Returns player's currently displayed scoreboard. This can be either with configuration, overridden with commands or the API. Will return null if player does not see any scoreboard due to not meeting any display condition.
      Parameters:
      player - player to get active scoreboard of
      Returns:
      player's active scoreboard or null if player has no scoreboard