> ## 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.

# Scoreboard API: Manage Players, Teams, and Sidebars

> Scoreboard is VelaBoard's central manager for players, teams, and sidebars. Obtain one via ScoreboardHandler.createScoreboard() to begin using the API.

`Scoreboard` is the central object managing players, teams, and sidebars. Obtain one via `ScoreboardHandler.createScoreboard()`. Every player you track, team you configure, and sidebar you display belongs to a single `Scoreboard` instance.

## Player management

Register players with the scoreboard before creating sidebars or assigning them to teams.

| Method                 | Returns            | Description                                  |
| ---------------------- | ------------------ | -------------------------------------------- |
| `getPlayers()`         | `Collection<UUID>` | All registered player UUIDs                  |
| `addPlayer(Player)`    | `void`             | Register a player with this scoreboard       |
| `removePlayer(Player)` | `void`             | Unregister a player and clean up their state |

## Team management

Teams group players under shared visual properties such as colors, prefixes, and collision rules.

| Method                         | Returns           | Description                                                           |
| ------------------------------ | ----------------- | --------------------------------------------------------------------- |
| `team(String name)`            | `Team`            | Create a team by name if it does not exist, or retrieve it if it does |
| `getTeam(String name)`         | `Team` (nullable) | Retrieve an existing team — returns `null` if not found               |
| `getTeamOf(Player)`            | `Team` (nullable) | Get the team a player belongs to — returns `null` if not on a team    |
| `hasTeam(String name)`         | `boolean`         | Check if a team with the given name exists                            |
| `removeTeam(String name)`      | `void`            | Delete a team by name                                                 |
| `removePlayerFromTeam(Player)` | `void`            | Remove a player from their current team                               |
| `clearTeams()`                 | `void`            | Delete all teams from this scoreboard                                 |

## Sidebar management

A scoreboard can manage per-player sidebars (`PlayerSidebar`) and shared sidebars (`SharedSidebar`) simultaneously.

| Method                                         | Returns                    | Description                                               |
| ---------------------------------------------- | -------------------------- | --------------------------------------------------------- |
| `createPlayerSidebar(String title)`            | `PlayerSidebar`            | Create a new player sidebar with the given title          |
| `createSharedSidebar(String title)`            | `SharedSidebar`            | Create a shared sidebar with an auto-generated ID         |
| `createSharedSidebar(String id, String title)` | `SharedSidebar`            | Create a shared sidebar with an explicit ID               |
| `getPlayerSidebar(Player)`                     | `PlayerSidebar` (nullable) | Get the `PlayerSidebar` assigned to the player            |
| `getSharedSidebar(Player)`                     | `SharedSidebar` (nullable) | Get the shared sidebar the player belongs to              |
| `getSharedSidebar(String id)`                  | `SharedSidebar` (nullable) | Get a shared sidebar by its ID                            |
| `getSidebar(Player)`                           | `Sidebar` (nullable)       | Get any active sidebar for the player, regardless of type |
| `hasSidebar(Player)`                           | `boolean`                  | Check if the player has an active sidebar                 |
| `removePlayerFromSidebar(Player)`              | `void`                     | Remove the player from their current sidebar              |

## Example

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

// Register player
board.addPlayer(player);

// Create team
Team team = board.team("staff");
team.setColor(TeamColor.GOLD).addPlayer(player);

// Create sidebar
PlayerSidebar sidebar = board.createPlayerSidebar("§6Staff Panel");
sidebar.setLine(0, "§7Role: §6Admin");
sidebar.setPlayer(player);
sidebar.show();
```
