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

# Sidebar Interface: Shared Methods for All Sidebar Types

> Sidebar is the base interface implemented by PlayerSidebar and SharedSidebar, providing title, line management, visibility control, and lifecycle methods.

`Sidebar` is the base interface implemented by both `PlayerSidebar` and `SharedSidebar`. It provides the methods common to all sidebar types — managing the title and lines, controlling visibility, checking the sidebar type, and destroying it when you are done. When you have a `Sidebar` reference of unknown type, use the type-checking and cast helpers to work with it safely.

## Title and lines

| Method                           | Returns             | Description                         |
| -------------------------------- | ------------------- | ----------------------------------- |
| `getTitle()`                     | `String`            | Current sidebar title               |
| `setTitle(String title)`         | `void`              | Update the sidebar title            |
| `setLine(int line, String text)` | `void`              | Set the text at a line index (0–14) |
| `getLine(int line)`              | `String` (nullable) | Get text at a line index, or null   |
| `removeLine(int line)`           | `void`              | Remove a specific line              |
| `clearLines()`                   | `void`              | Remove all lines                    |

Line indices range from `0` to `14`, giving a maximum of 15 lines.

## Visibility

| Method              | Returns   | Description                                              |
| ------------------- | --------- | -------------------------------------------------------- |
| `canView()`         | `boolean` | Whether the sidebar is allowed to be shown               |
| `canView(boolean)`  | `void`    | Enable or disable the sidebar from being shown           |
| `isBeingViewed()`   | `boolean` | Whether the sidebar is currently visible to any player   |
| `hasPlayer(Player)` | `boolean` | Whether the given player is associated with this sidebar |

## Type checking

| Method              | Returns                   | Description                       |
| ------------------- | ------------------------- | --------------------------------- |
| `isPlayerSidebar()` | `boolean`                 | True if this is a `PlayerSidebar` |
| `isSharedSidebar()` | `boolean`                 | True if this is a `SharedSidebar` |
| `asPlayerSidebar()` | `Optional<PlayerSidebar>` | Cast helper                       |
| `asSharedSidebar()` | `Optional<SharedSidebar>` | Cast helper                       |

## Lifecycle

| Method        | Returns   | Description                        |
| ------------- | --------- | ---------------------------------- |
| `remove()`    | `void`    | Permanently destroy this sidebar   |
| `isRemoved()` | `boolean` | Whether `remove()` has been called |

## Example

```java theme={null}
Sidebar sidebar = board.getSidebar(player);
if (sidebar != null && !sidebar.isRemoved()) {
    sidebar.setTitle("§e§lUpdated Title");
    sidebar.setLine(0, "§7New content");
    // Check type
    sidebar.asPlayerSidebar().ifPresent(ps -> ps.show());
}
```
