endstone/scoreboard

Classes

NameDescription
CriteriaRepresents a scoreboard criteria.
ObjectiveRepresents an objective on a scoreboard that can show scores specific to entries.
ScoreRepresents a score for an objective on a scoreboard.
ScoreboardRepresents a scoreboard.

Enums

NameDescription
DisplaySlotLocations for displaying objectives to the player.
ObjectiveSortOrderRepresents the sort order of objectives on a DisplaySlot.
RenderTypeControls the way in which an Objective is rendered on the client side.

Type Aliases

NameDescription
ScoreEntry

classCriteria

Defined in <endstone/scoreboard/criteria.h>

Represents a scoreboard criteria.

Enums

NameDescription
Type

Methods

NameDescription
~Criteria
getNameGet the name of this criteria (its unique id).
isReadOnlyGet whether or not this criteria is read only. If read only, scoreboards with this criteria cannot have their scores changed.
getDefaultRenderType

enumType

Type

Values

NameValueDescription
DummyThe dummy criteria. Not changed by the server.

meth~Criteriavirtual

~Criteria() =default

methgetNameabstractconst

std::string getName() const =0

Get the name of this criteria (its unique id).

Returns

TypeDescription
std::stringthe name

methisReadOnlyabstractconst

bool isReadOnly() const =0

Get whether or not this criteria is read only. If read only, scoreboards with this criteria cannot have their scores changed.

Returns

TypeDescription
booltrue if read only, false otherwise

methgetDefaultRenderTypeabstractconst

RenderType getDefaultRenderType() const =0

Get the RenderType used by default for this criteria.

Returns

TypeDescription
RenderTypethe default render type

classObjective

Defined in <endstone/scoreboard/objective.h>

Represents an objective on a scoreboard that can show scores specific to entries.

Methods

NameDescription
~Objective
getNameGets the name of this Objective.
getDisplayNameGets the name displayed to players for this objective.
setDisplayNameSets the name displayed to players for this objective.
getCriteriaGets the criteria this objective tracks.
isModifiableGets if the objective's scores can be modified directly by a plugin.
getScoreboardGets the scoreboard to which this objective is attached.
unregisterUnregisters this objective from the associated Scoreboard.
isDisplayedGets if the objective is currently displayed in a slot.
getDisplaySlotGets the display slot this objective is displayed at.
getSortOrderGets the sort order for this objective.
setDisplaySlotSets the display slot for this objective. This will remove it from any other display slot.
setSortOrderSets the sort order for this objective.
setDisplaySets the display slot and sort order for this objective. This will remove it from any other display slot.
getRenderType
getScoreSets manner in which this objective will be rendered.
operator==
operator!=

meth~Objectivevirtual

~Objective() =default

methgetNameabstractconst

std::string getName() const =0

Gets the name of this Objective.

Returns

TypeDescription
std::stringthis objective's name

methgetDisplayNameabstractconst

std::string getDisplayName() const =0

Gets the name displayed to players for this objective.

Returns

TypeDescription
std::stringthis objective's display name

methsetDisplayNameabstract

void setDisplayName(std::string display_name) =0

Sets the name displayed to players for this objective.

Parameters

NameTypeDescription
display_namestd::stringDisplay name to set

methgetCriteriaabstractconst

const Criteria& getCriteria() const =0

Gets the criteria this objective tracks.

Returns

TypeDescription
const Criteria&this objective's criteria.

methisModifiableabstractconst

bool isModifiable() const =0

Gets if the objective's scores can be modified directly by a plugin.

Returns

TypeDescription
booltrue if scores are modifiable

methgetScoreboardabstractconst

Scoreboard& getScoreboard() const =0

Gets the scoreboard to which this objective is attached.

Returns

TypeDescription
Scoreboard&Owning scoreboard

methunregisterabstractconst

void unregister() const =0

Unregisters this objective from the associated Scoreboard.

methisDisplayedabstractconst

bool isDisplayed() const =0

Gets if the objective is currently displayed in a slot.

Returns

TypeDescription
booltrue if the objective is displayed

methgetDisplaySlotabstractconst

std::optional<DisplaySlot> getDisplaySlot() const =0

Gets the display slot this objective is displayed at.

Returns

TypeDescription
std::optional<DisplaySlot>the display slot for this objective

methgetSortOrderabstractconst

std::optional<ObjectiveSortOrder> getSortOrder() const =0

Gets the sort order for this objective.

Returns

TypeDescription
std::optional<ObjectiveSortOrder>The sort order for this objective.

methsetDisplaySlotabstract

void setDisplaySlot(std::optional<DisplaySlot> slot) =0

Sets the display slot for this objective. This will remove it from any other display slot.

Parameters

NameTypeDescription
slotstd::optional<DisplaySlot>The display slot where this objective should be displayed.

methsetSortOrderabstract

void setSortOrder(ObjectiveSortOrder order) =0

Sets the sort order for this objective.

Parameters

NameTypeDescription
orderObjectiveSortOrderThe sort order for this objective in the display slot.

methsetDisplayabstract

void setDisplay(std::optional<DisplaySlot> slot, ObjectiveSortOrder order) =0

Sets the display slot and sort order for this objective. This will remove it from any other display slot.

Parameters

NameTypeDescription
slotstd::optional<DisplaySlot>The display slot where this objective should be displayed.
orderObjectiveSortOrderThe sort order for this objective in the display slot.

methgetRenderTypeabstractconst

RenderType getRenderType() const =0

Gets manner in which this objective will be rendered.

Returns

TypeDescription
RenderTypethe render type

methgetScoreabstractconst

std::unique_ptr<Score> getScore(ScoreEntry entry) const =0

Sets manner in which this objective will be rendered.

Gets an entry's Score for this objective.

Parameters

NameTypeDescription
render_typenew render type
entryScoreEntryEntry for the Score

Returns

TypeDescription
std::unique_ptr<Score>Score tracking the Objective and entry specified

methoperator==abstractconst

bool operator==(const Objective& other) const =0

methoperator!=abstractconst

bool operator!=(const Objective& other) const =0

classScore

Defined in <endstone/scoreboard/score.h>

Represents a score for an objective on a scoreboard.

Methods

NameDescription
~Score
getEntryGets the entry being tracked by this Score.
getValueGets the current score.
setValueSets the current score.
isScoreSetShows if this score has been set at any point in time.
getObjectiveGets the Objective being tracked by this Score.
getScoreboardGets the scoreboard for the associated objective.

meth~Scorevirtual

~Score() =default

methgetEntryabstractconst

ScoreEntry getEntry() const =0

Gets the entry being tracked by this Score.

Returns

TypeDescription
ScoreEntrythis Score's tracked entry

methgetValueabstractconst

int getValue() const =0

Gets the current score.

Returns

TypeDescription
intthe current score

methsetValueabstract

void setValue(int score) =0

Sets the current score.

Parameters

NameTypeDescription
scoreintNew score

methisScoreSetabstractconst

bool isScoreSet() const =0

Shows if this score has been set at any point in time.

Returns

TypeDescription
boolif this score has been set before

methgetObjectiveabstractconst

Objective& getObjective() const =0

Gets the Objective being tracked by this Score.

Returns

TypeDescription
Objective&the owning objective's scoreboard

methgetScoreboardabstractconst

Scoreboard& getScoreboard() const =0

Gets the scoreboard for the associated objective.

Returns

TypeDescription
Scoreboard&the owning objective's scoreboard

classScoreboard

Defined in <endstone/scoreboard/scoreboard.h>

Bases: std::enable_shared_from_this<Scoreboard>

Represents a scoreboard.

Methods

NameDescription
~Scoreboard
addObjectiveRegisters an Objective on this Scoreboard.
addObjectiveRegisters an Objective on this Scoreboard.
addObjectiveRegisters an Objective on this Scoreboard.
getObjectiveGets an Objective on this Scoreboard by name.
getObjectiveGets the Objective currently displayed in a DisplaySlot on this Scoreboard.
getObjectivesGets all Objectives on this Scoreboard.
getObjectivesByCriteriaGets all Objectives of a Criteria on the Scoreboard.
getScoresGets all scores for an entry on this Scoreboard.
resetScoresRemoves all scores for an entry on this Scoreboard.
getEntriesGets all entries tracked by this Scoreboard.
clearSlotClears any objective in the specified slot.

meth~Scoreboardvirtual

~Scoreboard() =default

methaddObjectiveabstract

std::unique_ptr<Objective> addObjective(std::string name, Criteria::Type criteria) =0

Registers an Objective on this Scoreboard.

Parameters

NameTypeDescription
namestd::stringName of the Objective
criteriaCriteria::TypeCriteria for the Objective

Returns

TypeDescription
std::unique_ptr<Objective>A reference to the newly registered Objective.

methaddObjectiveabstract

std::unique_ptr<Objective> addObjective(std::string name, Criteria::Type criteria, std::string display_name) =0

Registers an Objective on this Scoreboard.

Parameters

NameTypeDescription
namestd::stringName of the Objective
criteriaCriteria::TypeCriteria type for the Objective
display_namestd::stringName displayed to players for the Objective.

Returns

TypeDescription
std::unique_ptr<Objective>A reference to the newly registered Objective.

methaddObjectiveabstract

std::unique_ptr<Objective> addObjective(std::string name, Criteria::Type criteria, std::string display_name, RenderType render_type) =0

Registers an Objective on this Scoreboard.

Parameters

NameTypeDescription
namestd::stringName of the Objective
criteriaCriteria::TypeCriteria type for the Objective
display_namestd::stringName displayed to players for the Objective.
render_typeRenderTypeManner of rendering the Objective

Returns

TypeDescription
std::unique_ptr<Objective>A reference to the newly registered Objective.

methgetObjectiveabstractconst

std::unique_ptr<Objective> getObjective(std::string name) const =0

Gets an Objective on this Scoreboard by name.

Parameters

NameTypeDescription
namestd::stringName of the Objective

Returns

TypeDescription
std::unique_ptr<Objective>the Objective or nullptr if it does not exist

methgetObjectiveabstractconst

std::unique_ptr<Objective> getObjective(DisplaySlot slot) const =0

Gets the Objective currently displayed in a DisplaySlot on this Scoreboard.

Parameters

NameTypeDescription
slotDisplaySlotThe DisplaySlot

Returns

TypeDescription
std::unique_ptr<Objective>the Objective currently displayed or nullptr if nothing is displayed in that DisplaySlot

methgetObjectivesabstractconst

std::vector<std::unique_ptr<Objective>> getObjectives() const =0

Gets all Objectives on this Scoreboard.

Returns

TypeDescription
std::vector<std::unique_ptr<Objective>>A list of all Objectives on this Scoreboard

methgetObjectivesByCriteriaabstractconst

std::vector<std::unique_ptr<Objective>> getObjectivesByCriteria(Criteria::Type criteria) const =0

Gets all Objectives of a Criteria on the Scoreboard.

Parameters

NameTypeDescription
criteriaCriteria::TypeCriteria type to search by

Returns

TypeDescription
std::vector<std::unique_ptr<Objective>>A list of Objectives using the specified Criteria

methgetScoresabstractconst

std::vector<std::unique_ptr<Score>> getScores(ScoreEntry entry) const =0

Gets all scores for an entry on this Scoreboard.

Parameters

NameTypeDescription
entryScoreEntrythe entry whose scores are being retrieved

Returns

TypeDescription
std::vector<std::unique_ptr<Score>>a list of all scores tracked for the entry

methresetScoresabstract

void resetScores(ScoreEntry entry) =0

Removes all scores for an entry on this Scoreboard.

Parameters

NameTypeDescription
entryScoreEntrythe entry to drop all current scores for

methgetEntriesabstractconst

std::vector<ScoreEntry> getEntries() const =0

Gets all entries tracked by this Scoreboard.

Returns

TypeDescription
std::vector<ScoreEntry>A list of all tracked entries

methclearSlotabstract

void clearSlot(DisplaySlot slot) =0

Clears any objective in the specified slot.

Parameters

NameTypeDescription
slotDisplaySlotthe slot to remove objectives

enumDisplaySlot

DisplaySlot

Locations for displaying objectives to the player.

Values

NameValueDescription
BelowNameDisplays the score below the player's name.
PlayerListDisplays the score in the player list on the pause screen.
SideBarDisplays the score on the side of the player's screen.

enumObjectiveSortOrder

ObjectiveSortOrder

Represents the sort order of objectives on a DisplaySlot.

Values

NameValueDescription
AscendingSorts the objectives in the ascending order.
DescendingSorts the objectives in the descending order.

enumRenderType

std::uint8_t RenderType

Controls the way in which an Objective is rendered on the client side.

Values

NameValueDescription
IntegerDisplay integer value.
HeartsDisplay number of hearts corresponding to value.

typeScoreEntry

An entry for a score.

On this page