> ## Documentation Index
> Fetch the complete documentation index at: https://velas.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Show a Shared Sidebar to Multiple Players at Once

> Use SharedSidebar to display identical scoreboard content to many players simultaneously — ideal for server-wide stats, events, or announcements.

`SharedSidebar` lets you show the same scoreboard to any number of players simultaneously — ideal for server-wide stats, global event timers, or any content that doesn't differ between players.

## Creating a shared sidebar

Create a `SharedSidebar` through your `Scoreboard` instance. You can provide an explicit string ID or let VelaBoard generate one automatically.

```java theme={null}
// With an explicit ID
SharedSidebar stats = board.createSharedSidebar("server-stats", "§b§lServer Stats");

// With an auto-generated ID
SharedSidebar stats = board.createSharedSidebar("§b§lServer Stats");
```

<Tip>
  Use an explicit ID when you need to retrieve the sidebar later. Call `board.getSharedSidebar("server-stats")` at any point to get a reference back by ID. Use `shared.getId()` to read the ID from an existing reference.
</Tip>

## Adding players and showing

Register players with the sidebar using `addPlayer`, then call `show()` to display it to all of them at once.

```java theme={null}
board.addPlayer(player);
stats.addPlayer(player);
stats.show();
```

To show the sidebar to one specific player by UUID without modifying the full roster, use `showTo`:

```java theme={null}
stats.showTo(player.getUniqueId());
```

### Full example

```java theme={null}
ScoreboardHandler handler = ScoreboardAPI.getHandler();
Scoreboard board = handler.createScoreboard();

SharedSidebar stats = board.createSharedSidebar("server-stats", "§b§lServer Stats");
stats.setLine(0, "§7Online: §f" + Bukkit.getOnlinePlayers().size());
stats.setLine(1, "§7TPS: §a20.0");

for (Player player : Bukkit.getOnlinePlayers()) {
    board.addPlayer(player);
    stats.addPlayer(player);
}
stats.show();
```

<Note>
  Updating a line on a `SharedSidebar` updates it for all viewers. There is no per-player line override — use a `PlayerSidebar` if you need content to differ between players.
</Note>

## Hiding

Hide the sidebar from all registered players at once, or from a single player by UUID.

```java theme={null}
// Hide from everyone
stats.hide();

// Hide from one player
stats.hideFrom(player.getUniqueId());
```

## Checking viewers

VelaBoard distinguishes between *players* (registered via `addPlayer`) and *viewers* (players currently seeing the sidebar). A player can be registered without currently viewing it — for example, after `hideFrom` is called.

| Method                 | Description                                                         |
| ---------------------- | ------------------------------------------------------------------- |
| `getPlayers()`         | Returns all players registered with the sidebar via `addPlayer`.    |
| `getViewers()`         | Returns the players currently viewing the sidebar.                  |
| `isViewedBy(UUID)`     | Returns `true` if the given player is currently seeing the sidebar. |
| `isBeingViewedByAll()` | Returns `true` if every registered player is currently viewing it.  |

```java theme={null}
if (!stats.isViewedBy(player.getUniqueId())) {
    stats.showTo(player.getUniqueId());
}

if (stats.isBeingViewedByAll()) {
    // all registered players are currently watching
}
```
