Class SidebarManager
java.lang.Object
net.joseplay.allianceutils.api.scoreboard.data.SidebarManager
Manages
Sidebar instances per player.
This class provides a simple cache system to ensure each player has at most one active sidebar instance.
All methods are static and operate on a global in-memory cache.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SidebarCreates or retrieves an existing sidebar for a player.static Sidebarget(org.bukkit.entity.Player player) Retrieves the sidebar of a player.static voidremove(org.bukkit.entity.Player player) Removes and destroys the sidebar of a player.static voidshutdown()Removes all sidebars and clears the cache.
-
Constructor Details
-
SidebarManager
public SidebarManager()
-
-
Method Details
-
create
Creates or retrieves an existing sidebar for a player.If a sidebar already exists, its title will be updated.
- Parameters:
player- the playertitle- the sidebar title- Returns:
- the existing or newly created sidebar
-
get
Retrieves the sidebar of a player.- Parameters:
player- the player- Returns:
- the sidebar or null if not present
-
remove
public static void remove(org.bukkit.entity.Player player) Removes and destroys the sidebar of a player.- Parameters:
player- the player
-
shutdown
public static void shutdown()Removes all sidebars and clears the cache.Should be called on plugin shutdown to prevent memory leaks.
-