Skip to Content
⚠ Under Construction
ReferenceC++ APIObjective

endstone::Objective

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

Functions:

NameDescription
getCriteriaGets the criteria this objective tracks.
getDisplayNameGets the name displayed to players for this objective.
getDisplaySlotGets the display slot this objective is displayed at.
getNameGets the name of this Objective .
getRenderType
getScoreSets manner in which this objective will be rendered.
getScoreboardGets the scoreboard to which this objective is attached.
getSortOrderGets the sort order for this objective.
isDisplayedGets if the objective is currently displayed in a slot.
isModifiableGets if the objective’s scores can be modified directly by a plugin.
setDisplaySets the display slot and sort order for this objective. This will remove it from any other display slot.
setDisplayNameSets the name displayed to players 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.
unregisterUnregisters this objective from the associated Scoreboard .

getCriteria

Result<const Criteria *> getCriteria() const

Gets the criteria this objective tracks.

Returns:

this objective’s criteria.

getDisplayName

Result<std::string> getDisplayName() const

Gets the name displayed to players for this objective.

Returns:

this objective’s display name

getDisplaySlot

Result<DisplaySlot> getDisplaySlot() const

Gets the display slot this objective is displayed at.

Returns:

the display slot for this objective

getName

Result<std::string> getName() const

Gets the name of this Objective .

Returns:

this objective’s name

getRenderType

Result<RenderType> getRenderType() const

Gets manner in which this objective will be rendered.

Returns:

the render type

getScore

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

Sets manner in which this objective will be rendered.

Parameters:

  • render_type new render type

Gets an entry’s Score for this objective.

Parameters:

  • entry Entry for the Score

Returns:

Score tracking the Objective and entry specified

getScoreboard

Scoreboard &getScoreboard() const

Gets the scoreboard to which this objective is attached.

Returns:

Owning scoreboard

getSortOrder

Result<ObjectiveSortOrder> getSortOrder() const

Gets the sort order for this objective.

Returns:

The sort order for this objective.

isDisplayed

Result<bool> isDisplayed() const

Gets if the objective is currently displayed in a slot.

Returns:

true if the objective is displayed

isModifiable

Result<bool> isModifiable() const

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

Returns:

true if scores are modifiable

setDisplay

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

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

Parameters:

  • slot The display slot where this objective should be displayed.
  • order The sort order for this objective in the display slot.

setDisplayName

Result<void> setDisplayName(std::string display_name)

Sets the name displayed to players for this objective.

Parameters:

  • display_name Display name to set

setDisplaySlot

Result<void> setDisplaySlot(std::optional<DisplaySlot> slot)

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

Parameters:

  • slot The display slot where this objective should be displayed.

setSortOrder

Result<void> setSortOrder(ObjectiveSortOrder order)

Sets the sort order for this objective.

Parameters:

  • order The sort order for this objective in the display slot.

unregister

Result<void> unregister() const

Unregisters this objective from the associated Scoreboard .

Last updated on