java.lang.Object
net.joseplay.allianceutils.api.scoreboard.entities.Sidebar
Direct Known Subclasses:
BukkitSidebar, PacketSidebar

public abstract class Sidebar extends Object
Abstract representation of a player sidebar (scoreboard).

This class provides a unified abstraction layer for different scoreboard implementations (packet-based or Bukkit-based).

It also integrates with the TAB plugin to disable its scoreboard when a custom sidebar is applied.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.bukkit.entity.Player
    Target player for this sidebar instance.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Sidebar(org.bukkit.entity.Player player)
    Constructs a new sidebar instance for the given player.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Clears all lines from the sidebar without removing it.
    static Sidebar
    create(org.bukkit.entity.Player player, String title)
    Factory method for creating a sidebar implementation.
    abstract void
    Fully removes the sidebar from the player.
    abstract void
    removeLine(int line)
    Removes a specific line from the sidebar.
    void
    Restores the default scoreboard behavior for the player.
    abstract void
    setLine(int line, String text)
    Sets or updates a line at a specific position.
    abstract void
    Updates the sidebar title.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • player

      protected final org.bukkit.entity.Player player
      Target player for this sidebar instance.
  • Constructor Details

    • Sidebar

      protected Sidebar(org.bukkit.entity.Player player)
      Constructs a new sidebar instance for the given player.

      If the TAB plugin is present, its scoreboard is disabled to prevent conflicts with this custom implementation.

      Parameters:
      player - the player associated with this sidebar
  • Method Details

    • setTitle

      public abstract void setTitle(String title)
      Updates the sidebar title.
      Parameters:
      title - new title value
    • setLine

      public abstract void setLine(int line, String text)
      Sets or updates a line at a specific position.
      Parameters:
      line - line index (position)
      text - content to display
    • removeLine

      public abstract void removeLine(int line)
      Removes a specific line from the sidebar.
      Parameters:
      line - line index to remove
    • remove

      public abstract void remove()
      Fully removes the sidebar from the player.

      This should clean all resources and restore previous state if necessary.

    • setDefaultSB

      public void setDefaultSB()
      Restores the default scoreboard behavior for the player.

      If TAB is installed, its scoreboard will be re-enabled. Otherwise, the main Bukkit scoreboard will be applied.

    • clear

      public abstract void clear()
      Clears all lines from the sidebar without removing it.
    • create

      public static Sidebar create(org.bukkit.entity.Player player, String title)
      Factory method for creating a sidebar implementation.

      If PacketEvents is available, a packet-based implementation is used. Otherwise, a Bukkit-based implementation is returned.

      Parameters:
      player - target player
      title - initial title
      Returns:
      concrete sidebar implementation