Scoreboard
Namespace Mc.Scripting · Kind class (static)
public static class ScoreboardThe server’s scoreboard (shared by all players, saved with the world, edited by /scoreboard): objectives with scores per holder name and their display slots. Every change reaches every player’s client. Use Sidebar for per-player content.
Methods
Section titled “Methods”| Member | Description |
|---|---|
CreateObjective |
Creates an objective. |
static Objective? GetObjective(string name) |
An existing objective by name; null when there is none. |
static bool RemoveObjective(Objective objective) |
Deletes an objective and all its scores. |
static void SetDisplay(DisplaySlot slot, Objective? objective) |
Shows an objective in a display slot (null clears the slot). |
CreateObjective
Section titled “CreateObjective”public static Objective CreateObjective(string name, Component? title = null, string criteria = "dummy")Creates an objective. Objectives are part of the world: they stay until removed (they are not owned by the plugin).
Parameters
| Name | Type | Description |
|---|---|---|
name |
string |
The name, 1 to 16 characters (letters, digits, _ - . +). |
title |
Component? = null |
The display name; defaults to the name. |
criteria |
string = "dummy" |
The criterion; dummy (plugins and commands set the score) or trigger. |
Returns Objective: The objective.
Throws
System.InvalidOperationException: An objective with that name exists, or the name is not valid.
GetObjective
Section titled “GetObjective”public static Objective? GetObjective(string name)An existing objective by name; null when there is none.
Parameters
| Name | Type | Description |
|---|---|---|
name |
string |
The objective name. |
Returns Objective?
RemoveObjective
Section titled “RemoveObjective”public static bool RemoveObjective(Objective objective)Deletes an objective and all its scores.
Parameters
| Name | Type | Description |
|---|---|---|
objective |
Objective |
The objective. |
Returns bool: Whether it existed.
SetDisplay
Section titled “SetDisplay”public static void SetDisplay(DisplaySlot slot, Objective? objective)Shows an objective in a display slot (null clears the slot).
Parameters
| Name | Type | Description |
|---|---|---|
slot |
DisplaySlot |
The slot. |
objective |
Objective? |
The objective, null to clear. |