Interface Scoreboard


public interface Scoreboard
An interface allowing to work with scoreboard, such as adding players, removing players and changing lines. New instance can be created using ScoreboardManager.createScoreboard(String, String, List), for scoreboards from config ScoreboardManager.getRegisteredScoreboards().
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds line with specified text on the bottom of scoreboard.
    Returns list of lines in this scoreboard in the order they appear in game (first line is on top).
    Returns internal name of this scoreboard.
    Returns raw title of this scoreboard.
    void
    removeLine(int index)
    Removes line with specified index.
    void
    Sets title to specified value.
    void
    Unregisters this scoreboard from all players who can see it.
  • Method Details

    • getName

      String getName()
      Returns internal name of this scoreboard. Name is defined in registration, scoreboards from config use name they were defined with. This value is used internally and in /tab announce scoreboard command.
      Returns:
      custom name of this scoreboard
    • getTitle

      String getTitle()
      Returns raw title of this scoreboard. Placeholders stay in their raw format.
      Returns:
      scoreboard title
      See Also:
    • setTitle

      void setTitle(String title)
      Sets title to specified value. Placeholders are refreshed automatically with refresh intervals defined in config. No need to call this method to try to keep placeholders up to date. Supports RGB codes using any of the supported formats.

      Length is limited to 32 characters on <1.13. If the limit is exceeded, text will be cut to 32 characters.

      Calling this method with same title as before will not do anything.

      Parameters:
      title - New title to use with placeholder support
      See Also:
    • getLines

      List<Line> getLines()
      Returns list of lines in this scoreboard in the order they appear in game (first line is on top). This list should only be used for reading, for adding/removing lines see addLine(String) and removeLine(int).
      Returns:
      list of lines in this scoreboard
      See Also:
    • addLine

      void addLine(String text)
      Adds line with specified text on the bottom of scoreboard. Supports placeholders, which will automatically be refreshed.
      Parameters:
      text - Text to display
      See Also:
    • removeLine

      void removeLine(int index)
      Removes line with specified index. Index starts at 0 and ends at getLines().size()-1.
      Parameters:
      index - Index of line to remove, starting at 0
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getLines().size())
      See Also:
    • unregister

      void unregister()
      Unregisters this scoreboard from all players who can see it.