Class SidebarManager

java.lang.Object
net.joseplay.allianceutils.api.scoreboard.data.SidebarManager

public class SidebarManager extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Sidebar
    create(org.bukkit.entity.Player player, String title)
    Creates or retrieves an existing sidebar for a player.
    static Sidebar
    get(org.bukkit.entity.Player player)
    Retrieves the sidebar of a player.
    static void
    remove(org.bukkit.entity.Player player)
    Removes and destroys the sidebar of a player.
    static void
    Removes all sidebars and clears the cache.

    Methods inherited from class java.lang.Object

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

    • SidebarManager

      public SidebarManager()
  • Method Details

    • create

      public static Sidebar create(org.bukkit.entity.Player player, String title)
      Creates or retrieves an existing sidebar for a player.

      If a sidebar already exists, its title will be updated.

      Parameters:
      player - the player
      title - the sidebar title
      Returns:
      the existing or newly created sidebar
    • get

      public static Sidebar get(org.bukkit.entity.Player player)
      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.