Sidebar
Namespace Mc.Scripting · Kind class (sealed)
public sealed class Sidebar : IDisposable, IPluginResourceA sidebar scoreboard (the list of lines at the right of the screen) shown to chosen players. Each sidebar is a private objective sent only to its viewers, so different players can see different content at the same time (create one sidebar per player for personal lines). Lines are rich text, line 0 is the top; vanilla shows at most 15. Create it with Sidebars.Create; it disappears from the viewers when the plugin unloads.
Fields
Section titled “Fields”| Member | Description |
|---|---|
const int MaxLines = 15 |
The number of lines the client can show. |
MaxLines
Section titled “MaxLines”public const int MaxLines = 15;The number of lines the client can show.
Properties
Section titled “Properties”| Member | Description |
|---|---|
int LineCount { get; } |
The number of lines currently set. |
Component Title { get; set; } |
The title above the lines. |
IReadOnlyList<Player> Viewers { get; } |
The players who currently see this sidebar (those who left are dropped). |
LineCount
Section titled “LineCount”public int LineCount { get; }The number of lines currently set.
public Component Title { get; set; }The title above the lines.
Viewers
Section titled “Viewers”public IReadOnlyList<Player> Viewers { get; }The players who currently see this sidebar (those who left are dropped).
Methods
Section titled “Methods”| Member | Description |
|---|---|
void Clear() |
Removes every line. |
void Dispose() |
|
void Hide(Player player) |
Hides the sidebar from a player. |
bool IsShownTo(Player player) |
Whether the player sees this sidebar. |
void Remove() |
Hides the sidebar from everybody and releases it. |
void SetLine(int index, Component? text) |
Sets one line (0 is the top). |
void SetLines(IReadOnlyList<Component> lines) |
Replaces all lines: the first text becomes line 0, lines beyond the given ones are removed. |
void Show(Player player) |
Shows the sidebar to a player (replacing any sidebar of the server scoreboard on his screen). |
public void Clear()Removes every line.
Dispose
Section titled “Dispose”public void Dispose()public void Hide(Player player)Hides the sidebar from a player.
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
The player. |
IsShownTo
Section titled “IsShownTo”public bool IsShownTo(Player player)Whether the player sees this sidebar.
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
The player. |
Returns bool
Remove
Section titled “Remove”public void Remove()Hides the sidebar from everybody and releases it.
SetLine
Section titled “SetLine”public void SetLine(int index, Component? text)Sets one line (0 is the top). A null text removes the line.
Parameters
| Name | Type | Description |
|---|---|---|
index |
int |
The line, 0 to Sidebar.MaxLines - 1. |
text |
Component? |
The text, null to remove. |
SetLines
Section titled “SetLines”public void SetLines(IReadOnlyList<Component> lines)Replaces all lines: the first text becomes line 0, lines beyond the given ones are removed.
Parameters
| Name | Type | Description |
|---|---|---|
lines |
IReadOnlyList<Component> |
The texts. |
public void Show(Player player)Shows the sidebar to a player (replacing any sidebar of the server scoreboard on his screen).
Parameters
| Name | Type | Description |
|---|---|---|
player |
Player |
The player. |