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 |
RenderType |
Controls the way in which an |
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 |
is_read_only |
bool
|
|
name |
str
|
The name of this criteria (its unique id). |
default_render_type
property
¶
default_render_type: RenderType
The RenderType used by default for this criteria.
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
¶
Displays the score below the player's name.
PLAYER_LIST
class-attribute
instance-attribute
¶
Displays the score in the player list on the pause screen.
SIDE_BAR
class-attribute
instance-attribute
¶
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 |
set_display |
Sets the display slot and sort order for this objective. |
unregister |
Unregisters this objective from the associated |
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
|
|
is_modifiable |
bool
|
|
name |
str
|
The name of this |
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. |
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_modifiable
property
¶
is_modifiable: bool
True if the objective's scores can be modified directly by a plugin.
sort_order
property
writable
¶
sort_order: ObjectiveSortOrder | None
The sort order for this objective.
get_score
¶
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
|
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 |
RenderType
¶
Score
¶
Represents a score for an objective on a scoreboard.
Attributes:
| Name | Type | Description |
|---|---|---|
entry |
Player | Actor | str
|
The entry being tracked by this |
is_score_set |
bool
|
|
objective |
Objective
|
The |
scoreboard |
Scoreboard
|
The scoreboard for the associated objective. |
value |
int
|
The current score. |
Scoreboard
¶
Represents a scoreboard.
Methods:
| Name | Description |
|---|---|
add_objective |
Registers an |
clear_slot |
Clears any objective in the specified slot. |
get_objective |
|
get_objectives_by_criteria |
Gets all |
get_scores |
Gets all scores for an entry on this |
reset_scores |
Removes all scores for an entry on this |
Attributes:
| Name | Type | Description |
|---|---|---|
entries |
list[Player | Actor | str]
|
A list of all entries tracked by this |
objectives |
list[Objective]
|
A list of all |
entries
property
¶
A list of all entries tracked by 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 |
required |
criteria
|
Type
|
|
required |
display_name
|
str | None
|
Name displayed to players for the |
None
|
render_type
|
RenderType
|
Manner of rendering the |
INTEGER
|
Returns:
| Type | Description |
|---|---|
Objective
|
The newly registered |
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 |