Skip to content

Sidebar

Namespace Mc.Scripting · Kind class (sealed)

public sealed class Sidebar : IDisposable, IPluginResource

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

Member Description
const int MaxLines = 15 The number of lines the client can show.
public const int MaxLines = 15;

The number of lines the client can show.

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).
public int LineCount { get; }

The number of lines currently set.

public Component Title { get; set; }

The title above the lines.

public IReadOnlyList<Player> Viewers { get; }

The players who currently see this sidebar (those who left are dropped).

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.

public void Dispose()
public void Hide(Player player)

Hides the sidebar from a player.

Parameters

Name Type Description
player Player The player.
public bool IsShownTo(Player player)

Whether the player sees this sidebar.

Parameters

Name Type Description
player Player The player.

Returns bool

public void Remove()

Hides the sidebar from everybody and releases it.

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

Component · IPluginResource · Player