endstone/scoreboard
Classes
| Name | Description |
|---|---|
Criteria | Represents a scoreboard criteria. |
Objective | Represents an objective on a scoreboard that can show scores specific to entries. |
Score | Represents a score for an objective on a scoreboard. |
Scoreboard | Represents a scoreboard. |
Enums
| Name | Description |
|---|---|
DisplaySlot | Locations for displaying objectives to the player. |
ObjectiveSortOrder | Represents the sort order of objectives on a DisplaySlot. |
RenderType | Controls the way in which an Objective is rendered on the client side. |
Type Aliases
| Name | Description |
|---|---|
ScoreEntry |
classCriteria
Defined in <endstone/scoreboard/criteria.h>
Represents a scoreboard criteria.
Enums
| Name | Description |
|---|---|
Type |
Methods
| Name | Description |
|---|---|
~Criteria | |
getName | Get the name of this criteria (its unique id). |
isReadOnly | Get whether or not this criteria is read only. If read only, scoreboards with this criteria cannot have their scores changed. |
getDefaultRenderType |
enumType
TypeValues
| Name | Value | Description |
|---|---|---|
Dummy | The dummy criteria. Not changed by the server. |
meth~Criteriavirtual
~Criteria() =defaultmethgetNameabstractconst
std::string getName() const =0Get the name of this criteria (its unique id).
Returns
| Type | Description |
|---|---|
std::string | the name |
methisReadOnlyabstractconst
bool isReadOnly() const =0Get whether or not this criteria is read only. If read only, scoreboards with this criteria cannot have their scores changed.
Returns
| Type | Description |
|---|---|
bool | true if read only, false otherwise |
methgetDefaultRenderTypeabstractconst
RenderType getDefaultRenderType() const =0Get the RenderType used by default for this criteria.
Returns
| Type | Description |
|---|---|
RenderType | the default render type |
classObjective
Defined in <endstone/scoreboard/objective.h>
Represents an objective on a scoreboard that can show scores specific to entries.
Methods
| Name | Description |
|---|---|
~Objective | |
getName | Gets the name of this Objective. |
getDisplayName | Gets the name displayed to players for this objective. |
setDisplayName | Sets the name displayed to players for this objective. |
getCriteria | Gets the criteria this objective tracks. |
isModifiable | Gets if the objective's scores can be modified directly by a plugin. |
getScoreboard | Gets the scoreboard to which this objective is attached. |
unregister | Unregisters this objective from the associated Scoreboard. |
isDisplayed | Gets if the objective is currently displayed in a slot. |
getDisplaySlot | Gets the display slot this objective is displayed at. |
getSortOrder | Gets the sort order for this objective. |
setDisplaySlot | Sets the display slot for this objective. This will remove it from any other display slot. |
setSortOrder | Sets the sort order for this objective. |
setDisplay | Sets the display slot and sort order for this objective. This will remove it from any other display slot. |
getRenderType | |
getScore | Sets manner in which this objective will be rendered. |
operator== | |
operator!= |
meth~Objectivevirtual
~Objective() =defaultmethgetNameabstractconst
std::string getName() const =0Gets the name of this Objective.
Returns
| Type | Description |
|---|---|
std::string | this objective's name |
methgetDisplayNameabstractconst
std::string getDisplayName() const =0Gets the name displayed to players for this objective.
Returns
| Type | Description |
|---|---|
std::string | this objective's display name |
methsetDisplayNameabstract
void setDisplayName(std::string display_name) =0Sets the name displayed to players for this objective.
Parameters
| Name | Type | Description |
|---|---|---|
display_name | std::string | Display name to set |
methgetCriteriaabstractconst
const Criteria& getCriteria() const =0Gets the criteria this objective tracks.
Returns
| Type | Description |
|---|---|
const Criteria& | this objective's criteria. |
methisModifiableabstractconst
bool isModifiable() const =0Gets if the objective's scores can be modified directly by a plugin.
Returns
| Type | Description |
|---|---|
bool | true if scores are modifiable |
methgetScoreboardabstractconst
Scoreboard& getScoreboard() const =0Gets the scoreboard to which this objective is attached.
Returns
| Type | Description |
|---|---|
Scoreboard& | Owning scoreboard |
methunregisterabstractconst
void unregister() const =0Unregisters this objective from the associated Scoreboard.
methisDisplayedabstractconst
bool isDisplayed() const =0Gets if the objective is currently displayed in a slot.
Returns
| Type | Description |
|---|---|
bool | true if the objective is displayed |
methgetDisplaySlotabstractconst
std::optional<DisplaySlot> getDisplaySlot() const =0Gets the display slot this objective is displayed at.
Returns
| Type | Description |
|---|---|
std::optional<DisplaySlot> | the display slot for this objective |
methgetSortOrderabstractconst
std::optional<ObjectiveSortOrder> getSortOrder() const =0Gets the sort order for this objective.
Returns
| Type | Description |
|---|---|
std::optional<ObjectiveSortOrder> | The sort order for this objective. |
methsetDisplaySlotabstract
void setDisplaySlot(std::optional<DisplaySlot> slot) =0Sets the display slot for this objective. This will remove it from any other display slot.
Parameters
| Name | Type | Description |
|---|---|---|
slot | std::optional<DisplaySlot> | The display slot where this objective should be displayed. |
methsetSortOrderabstract
void setSortOrder(ObjectiveSortOrder order) =0Sets the sort order for this objective.
Parameters
| Name | Type | Description |
|---|---|---|
order | ObjectiveSortOrder | The sort order for this objective in the display slot. |
methsetDisplayabstract
void setDisplay(std::optional<DisplaySlot> slot, ObjectiveSortOrder order) =0Sets the display slot and sort order for this objective. This will remove it from any other display slot.
Parameters
| Name | Type | Description |
|---|---|---|
slot | std::optional<DisplaySlot> | The display slot where this objective should be displayed. |
order | ObjectiveSortOrder | The sort order for this objective in the display slot. |
methgetRenderTypeabstractconst
RenderType getRenderType() const =0Gets manner in which this objective will be rendered.
Returns
| Type | Description |
|---|---|
RenderType | the render type |
methgetScoreabstractconst
std::unique_ptr<Score> getScore(ScoreEntry entry) const =0Sets manner in which this objective will be rendered.
Gets an entry's Score for this objective.
Parameters
| Name | Type | Description |
|---|---|---|
render_type | new render type | |
entry | ScoreEntry | Entry for the Score |
Returns
| Type | Description |
|---|---|
std::unique_ptr<Score> | Score tracking the Objective and entry specified |
methoperator==abstractconst
bool operator==(const Objective& other) const =0methoperator!=abstractconst
bool operator!=(const Objective& other) const =0classScore
Defined in <endstone/scoreboard/score.h>
Represents a score for an objective on a scoreboard.
Methods
| Name | Description |
|---|---|
~Score | |
getEntry | Gets the entry being tracked by this Score. |
getValue | Gets the current score. |
setValue | Sets the current score. |
isScoreSet | Shows if this score has been set at any point in time. |
getObjective | Gets the Objective being tracked by this Score. |
getScoreboard | Gets the scoreboard for the associated objective. |
meth~Scorevirtual
~Score() =defaultmethgetEntryabstractconst
ScoreEntry getEntry() const =0Gets the entry being tracked by this Score.
Returns
| Type | Description |
|---|---|
ScoreEntry | this Score's tracked entry |
methgetValueabstractconst
int getValue() const =0Gets the current score.
Returns
| Type | Description |
|---|---|
int | the current score |
methsetValueabstract
void setValue(int score) =0Sets the current score.
Parameters
| Name | Type | Description |
|---|---|---|
score | int | New score |
methisScoreSetabstractconst
bool isScoreSet() const =0Shows if this score has been set at any point in time.
Returns
| Type | Description |
|---|---|
bool | if this score has been set before |
methgetObjectiveabstractconst
Objective& getObjective() const =0Gets the Objective being tracked by this Score.
Returns
| Type | Description |
|---|---|
Objective& | the owning objective's scoreboard |
methgetScoreboardabstractconst
Scoreboard& getScoreboard() const =0Gets the scoreboard for the associated objective.
Returns
| Type | Description |
|---|---|
Scoreboard& | the owning objective's scoreboard |
classScoreboard
Defined in <endstone/scoreboard/scoreboard.h>
Bases: std::enable_shared_from_this<Scoreboard>
Represents a scoreboard.
Methods
| Name | Description |
|---|---|
~Scoreboard | |
addObjective | Registers an Objective on this Scoreboard. |
addObjective | Registers an Objective on this Scoreboard. |
addObjective | Registers an Objective on this Scoreboard. |
getObjective | Gets an Objective on this Scoreboard by name. |
getObjective | Gets the Objective currently displayed in a DisplaySlot on this Scoreboard. |
getObjectives | Gets all Objectives on this Scoreboard. |
getObjectivesByCriteria | Gets all Objectives of a Criteria on the Scoreboard. |
getScores | Gets all scores for an entry on this Scoreboard. |
resetScores | Removes all scores for an entry on this Scoreboard. |
getEntries | Gets all entries tracked by this Scoreboard. |
clearSlot | Clears any objective in the specified slot. |
meth~Scoreboardvirtual
~Scoreboard() =defaultmethaddObjectiveabstract
std::unique_ptr<Objective> addObjective(std::string name, Criteria::Type criteria) =0Registers an Objective on this Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | Name of the Objective |
criteria | Criteria::Type | Criteria for the Objective |
Returns
| Type | Description |
|---|---|
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) =0Registers an Objective on this Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | Name of the Objective |
criteria | Criteria::Type | Criteria type for the Objective |
display_name | std::string | Name displayed to players for the Objective. |
Returns
| Type | Description |
|---|---|
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) =0Registers an Objective on this Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | Name of the Objective |
criteria | Criteria::Type | Criteria type for the Objective |
display_name | std::string | Name displayed to players for the Objective. |
render_type | RenderType | Manner of rendering the Objective |
Returns
| Type | Description |
|---|---|
std::unique_ptr<Objective> | A reference to the newly registered Objective. |
methgetObjectiveabstractconst
std::unique_ptr<Objective> getObjective(std::string name) const =0Gets an Objective on this Scoreboard by name.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | Name of the Objective |
Returns
| Type | Description |
|---|---|
std::unique_ptr<Objective> | the Objective or nullptr if it does not exist |
methgetObjectiveabstractconst
std::unique_ptr<Objective> getObjective(DisplaySlot slot) const =0Gets the Objective currently displayed in a DisplaySlot on this Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
slot | DisplaySlot | The DisplaySlot |
Returns
| Type | Description |
|---|---|
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 =0Gets all Objectives on this Scoreboard.
Returns
| Type | Description |
|---|---|
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 =0Gets all Objectives of a Criteria on the Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
criteria | Criteria::Type | Criteria type to search by |
Returns
| Type | Description |
|---|---|
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 =0Gets all scores for an entry on this Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
entry | ScoreEntry | the entry whose scores are being retrieved |
Returns
| Type | Description |
|---|---|
std::vector<std::unique_ptr<Score>> | a list of all scores tracked for the entry |
methresetScoresabstract
void resetScores(ScoreEntry entry) =0Removes all scores for an entry on this Scoreboard.
Parameters
| Name | Type | Description |
|---|---|---|
entry | ScoreEntry | the entry to drop all current scores for |
methgetEntriesabstractconst
std::vector<ScoreEntry> getEntries() const =0Gets all entries tracked by this Scoreboard.
Returns
| Type | Description |
|---|---|
std::vector<ScoreEntry> | A list of all tracked entries |
methclearSlotabstract
void clearSlot(DisplaySlot slot) =0Clears any objective in the specified slot.
Parameters
| Name | Type | Description |
|---|---|---|
slot | DisplaySlot | the slot to remove objectives |
enumDisplaySlot
DisplaySlotLocations for displaying objectives to the player.
Values
| Name | Value | Description |
|---|---|---|
BelowName | Displays the score below the player's name. | |
PlayerList | Displays the score in the player list on the pause screen. | |
SideBar | Displays the score on the side of the player's screen. |
enumObjectiveSortOrder
ObjectiveSortOrderRepresents the sort order of objectives on a DisplaySlot.
Values
| Name | Value | Description |
|---|---|---|
Ascending | Sorts the objectives in the ascending order. | |
Descending | Sorts the objectives in the descending order. |
enumRenderType
std::uint8_t RenderTypeControls the way in which an Objective is rendered on the client side.
Values
| Name | Value | Description |
|---|---|---|
Integer | Display integer value. | |
Hearts | Display number of hearts corresponding to value. |
typeScoreEntry
std::variant<Player*, Actor*, std::string> ScoreEntryAn entry for a score.