ScoreboardHandler, Scoreboard, and a sidebar. This page shows you the complete flow to display a sidebar to a player and a shared sidebar visible to multiple players.
Display a player sidebar
APlayerSidebar is scoped to a single player. Use it for per-player HUDs that show individual data like score or level.
1
Get the handler
Obtain the
ScoreboardHandler from the API entry point.2
Create a scoreboard
Create a
Scoreboard instance through the handler.3
Register the player
Add the player to the scoreboard before creating any sidebars for them.
4
Create the sidebar
Create a
PlayerSidebar with a display title.5
Set lines
Populate the sidebar lines. Line
0 is the top line.6
Assign and show
Assign the sidebar to the player, then call
show() to display it.Display a shared sidebar
ASharedSidebar shows the same content to multiple players at once. Use it for server-wide information like online player count or a global event status.
showTo(UUID):
Call this code from within a Bukkit event handler such as
PlayerJoinEvent,
or at any point after the player is fully online. Calling addPlayer or
show before the player has joined will have no effect.