Skip to content

Scoreboard

endstone.scoreboard

Classes relating to manage the client side score display system.

Classes:

Name Description
Criteria

Represents a scoreboard criteria.

DisplaySlot

Locations for displaying objectives to the player

Objective

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

ObjectiveSortOrder

Represents the sort order of objectives on a DisplaySlot.

RenderType

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

Score

Represents a score for an objective on a scoreboard.

Scoreboard

Represents a scoreboard.

Criteria

Represents a scoreboard criteria.

Classes:

Name Description
Type

Represents a scoreboard criteria.

Attributes:

Name Type Description
DUMMY
default_render_type RenderType

The RenderType used by default for this criteria.

is_read_only bool

True if this criteria is read only.

name str

The name of this criteria (its unique id).

DUMMY class-attribute instance-attribute

DUMMY = DUMMY

default_render_type property

default_render_type: RenderType

The RenderType used by default for this criteria.

is_read_only property

is_read_only: bool

True if this criteria is read only.

If read only, scoreboards with this criteria cannot have their scores changed.

name property

name: str

The name of this criteria (its unique id).

Type

Bases: Enum

Represents a scoreboard criteria.

Attributes:

Name Type Description
DUMMY

The dummy criteria. Not changed by the server.

DUMMY class-attribute instance-attribute
DUMMY = 0

The dummy criteria. Not changed by the server.

DisplaySlot

Bases: Enum

Locations for displaying objectives to the player

Attributes:

Name Type Description
BELOW_NAME

Displays the score below the player's name.

PLAYER_LIST

Displays the score in the player list on the pause screen.

SIDE_BAR

Displays the score on the side of the player's screen.

BELOW_NAME class-attribute instance-attribute

BELOW_NAME = 0

Displays the score below the player's name.

PLAYER_LIST class-attribute instance-attribute

PLAYER_LIST = 1

Displays the score in the player list on the pause screen.

SIDE_BAR class-attribute instance-attribute

SIDE_BAR = 2

Displays the score on the side of the player's screen.

Objective

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

Methods:

Name Description
get_score

Gets an entry's Score for this objective.

set_display

Sets the display slot and sort order for this objective.

unregister

Unregisters this objective from the associated Scoreboard.

Attributes:

Name Type Description
criteria Criteria

The criteria this objective tracks.

display_name str

The name displayed to players for this objective.

display_slot DisplaySlot | None

The display slot this objective is displayed at.

is_displayed bool

True if the objective is currently displayed in a slot.

is_modifiable bool

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

name str

The name of this Objective.

render_type RenderType

The manner in which this objective will be rendered.

scoreboard Scoreboard

The scoreboard to which this objective is attached.

sort_order ObjectiveSortOrder | None

The sort order for this objective.

criteria property

criteria: Criteria

The criteria this objective tracks.

display_name property writable

display_name: str

The name displayed to players for this objective.

display_slot property writable

display_slot: DisplaySlot | None

The display slot this objective is displayed at.

is_displayed property

is_displayed: bool

True if the objective is currently displayed in a slot.

is_modifiable property

is_modifiable: bool

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

name property

name: str

The name of this Objective.

render_type property

render_type: RenderType

The manner in which this objective will be rendered.

scoreboard property

scoreboard: Scoreboard

The scoreboard to which this objective is attached.

sort_order property writable

sort_order: ObjectiveSortOrder | None

The sort order for this objective.

get_score

get_score(entry: Player | Actor | str) -> Score

Gets an entry's Score for this objective.

Parameters:

Name Type Description Default
entry Player | Actor | str

Entry for the Score.

required

Returns:

Type Description
Score

Score tracking the Objective and entry specified.

set_display

set_display(
    slot: DisplaySlot | None,
    order: ObjectiveSortOrder = ASCENDING,
) -> None

Sets the display slot and sort order for this objective.

This will remove it from any other display slot.

Parameters:

Name Type Description Default
slot DisplaySlot | None

The display slot where this objective should be displayed.

required
order ObjectiveSortOrder

The sort order for this objective in the display slot.

ASCENDING

unregister

unregister() -> None

Unregisters this objective from the associated Scoreboard.

ObjectiveSortOrder

Bases: Enum

Represents the sort order of objectives on a DisplaySlot.

Attributes:

Name Type Description
ASCENDING

Sorts the objectives in the ascending order

DESCENDING

Sorts the objectives in the descending order

ASCENDING class-attribute instance-attribute

ASCENDING = 0

Sorts the objectives in the ascending order

DESCENDING class-attribute instance-attribute

DESCENDING = 1

Sorts the objectives in the descending order

RenderType

Bases: Enum

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

Attributes:

Name Type Description
HEARTS
INTEGER

HEARTS class-attribute instance-attribute

HEARTS = 1

INTEGER class-attribute instance-attribute

INTEGER = 0

Score

Represents a score for an objective on a scoreboard.

Attributes:

Name Type Description
entry Player | Actor | str

The entry being tracked by this Score.

is_score_set bool

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

objective Objective

The Objective being tracked by this Score.

scoreboard Scoreboard

The scoreboard for the associated objective.

value int

The current score.

entry property

entry: Player | Actor | str

The entry being tracked by this Score.

is_score_set property

is_score_set: bool

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

objective property

objective: Objective

The Objective being tracked by this Score.

scoreboard property

scoreboard: Scoreboard

The scoreboard for the associated objective.

value property writable

value: int

The current score.

Scoreboard

Represents a scoreboard.

Methods:

Name Description
add_objective

Registers an Objective on this Scoreboard.

clear_slot

Clears any objective in the specified slot.

get_objective
get_objectives_by_criteria

Gets all Objectives of a Criteria on the Scoreboard.

get_scores

Gets all scores for an entry on this Scoreboard.

reset_scores

Removes all scores for an entry on this Scoreboard.

Attributes:

Name Type Description
entries list[Player | Actor | str]

A list of all entries tracked by this Scoreboard.

objectives list[Objective]

A list of all Objectives on this Scoreboard.

entries property

entries: list[Player | Actor | str]

A list of all entries tracked by this Scoreboard.

objectives property

objectives: list[Objective]

A list of all Objectives on this Scoreboard.

add_objective

add_objective(
    name: str,
    criteria: Type,
    display_name: str | None = None,
    render_type: RenderType = INTEGER,
) -> Objective

Registers an Objective on this Scoreboard.

Parameters:

Name Type Description Default
name str

Name of the Objective.

required
criteria Type

Criteria type for the Objective.

required
display_name str | None

Name displayed to players for the Objective. Defaults to name.

None
render_type RenderType

Manner of rendering the Objective.

INTEGER

Returns:

Type Description
Objective

The newly registered Objective.

clear_slot

clear_slot(slot: DisplaySlot) -> None

Clears any objective in the specified slot.

Parameters:

Name Type Description Default
slot DisplaySlot

The slot to remove objectives from.

required

get_objective

get_objective(name: str) -> Objective
get_objective(slot: DisplaySlot) -> Objective

get_objectives_by_criteria

get_objectives_by_criteria(
    criteria: Type,
) -> list[Objective]

Gets all Objectives of a Criteria on the Scoreboard.

Parameters:

Name Type Description Default
criteria Type

Criteria type to search by.

required

Returns:

Type Description
list[Objective]

A list of Objectives using the specified Criteria.

get_scores

get_scores(entry: Player | Actor | str) -> list[Score]

Gets all scores for an entry on this Scoreboard.

Parameters:

Name Type Description Default
entry Player | Actor | str

The entry whose scores are being retrieved.

required

Returns:

Type Description
list[Score]

A list of all scores tracked for the entry.

reset_scores

reset_scores(entry: Player | Actor | str) -> None

Removes all scores for an entry on this Scoreboard.

Parameters:

Name Type Description Default
entry Player | Actor | str

The entry to drop all current scores for.

required