Class Sidebar
java.lang.Object
net.joseplay.allianceutils.api.scoreboard.entities.Sidebar
- Direct Known Subclasses:
BukkitSidebar,PacketSidebar
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
FieldsModifier and TypeFieldDescriptionprotected final org.bukkit.entity.PlayerTarget player for this sidebar instance. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSidebar(org.bukkit.entity.Player player) Constructs a new sidebar instance for the given player. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclear()Clears all lines from the sidebar without removing it.static SidebarFactory method for creating a sidebar implementation.abstract voidremove()Fully removes the sidebar from the player.abstract voidremoveLine(int line) Removes a specific line from the sidebar.voidRestores the default scoreboard behavior for the player.abstract voidSets or updates a line at a specific position.abstract voidUpdates the sidebar title.
-
Field Details
-
player
protected final org.bukkit.entity.Player playerTarget 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
Updates the sidebar title.- Parameters:
title- new title value
-
setLine
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
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 playertitle- initial title- Returns:
- concrete sidebar implementation
-