Sidebars
The Sidebar API provides a robust, packet-based, and entirely flicker-free way to manage sideboards (scoreboards) for players. It supports dynamic per-player content, a priority-based overlapping system, and native support for hiding the red side numbers.
Creating a Sidebar
To create a sidebar, instantiate the Sidebar class with a unique Key and a priority level.
The priority level determines which sidebar a player sees if they are added to multiple sidebars simultaneously. The sidebar with the highest priority integer will be displayed.
Setting Content
You can assign both static Components and dynamic Function<Player, Component>s to the title and lines of the sidebar.
Using a Function allows you to use a single Sidebar instance globally, while still displaying player-specific data (like their individual ping, name, or stats). Sidebars support up to 15 lines (indexes 0 to 14).
Hiding the Score Numbers
In modern Minecraft versions, you can hide the red numbers that normally appear on the right side of the scoreboard. By default, AbyssalLib sidebars have these numbers hidden. You can toggle this behavior using setShowNumbers().
Managing Viewers and Priority
To show the sidebar to a player, simply add them as a viewer.
Because of the priority system, you can layer sidebars. For example, if a player is viewing a GlobalBoard (Priority 10) and you add them to a CombatBoard (Priority 50), the API will automatically transition their screen to the CombatBoard. When you remove them from the CombatBoard, it will seamlessly fall back to the GlobalBoard.
Cleanup
If you are completely removing a sidebar feature from your plugin (e.g., during a minigame reset or plugin reload), you must destroy the sidebar to clear it from the internal memory and remove it from all players currently viewing it.