Skip to content

scoreboard

Scoreboard

Python
Scoreboard(
    name: str,
    display_text: str | None = None,
    score_type: str | None = None,
)

Minecraft Scoreboard Objective representation and packet parser.

ATTRIBUTE DESCRIPTION
name

Unique name for the objective (max 16 chars).

TYPE: str

display_text

Text to be displayed for the score (max 32 chars).

TYPE: str

score_type

Type of score ("integer" or "hearts").

TYPE: str

scores

Dictionary mapping entity names to their scores.

TYPE: Dict[str, int]

is_displayed

Whether this objective is currently being displayed.

TYPE: bool

display_position

Position where the scoreboard is displayed (0-18).

TYPE: int

set_score

Python
set_score(entity_name: str, value: int) -> None

Set or update a score for an entity.

PARAMETER DESCRIPTION
entity_name

Name of the entity (username or UUID).

TYPE: str

value

The score value.

TYPE: int

remove_score

Python
remove_score(entity_name: str) -> None

Remove an entity's score.

PARAMETER DESCRIPTION
entity_name

Name of the entity to remove.

TYPE: str

get_score

Python
get_score(entity_name: str) -> int

Get the score for a specific entity.

PARAMETER DESCRIPTION
entity_name

Name of the entity.

TYPE: str

RETURNS DESCRIPTION
int

The score of the entity, or 0 if not found.

get_all_scores

Python
get_all_scores() -> Dict[str, int]

Get a copy of all scores.

RETURNS DESCRIPTION
Dict[str, int]

A dictionary mapping entity names to scores.

get_sorted_scores

Python
get_sorted_scores(
    reverse: bool = True,
) -> List[Tuple[str, int]]

Get all scores sorted by score value.

PARAMETER DESCRIPTION
reverse

Whether to sort in descending order.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
List[Tuple[str, int]]

List of (entity_name, score) tuples sorted by score.

get_player_scores

Python
get_player_scores() -> Dict[str, int]

Get scores for players (entity names without hyphens).

RETURNS DESCRIPTION
Dict[str, int]

Mapping of player names to their scores.

get_entity_scores

Python
get_entity_scores() -> Dict[str, int]

Get scores for entities (entity names with hyphens, i.e., UUIDs).

RETURNS DESCRIPTION
Dict[str, int]

Mapping of entity UUIDs to their scores.

clear_scores

Python
clear_scores() -> None

Remove all scores from the scoreboard.

is_hearts_type

Python
is_hearts_type() -> bool

Check if this scoreboard uses the 'hearts' type.

RETURNS DESCRIPTION
bool

True if score_type is "hearts", else False.

is_integer_type

Python
is_integer_type() -> bool

Check if this scoreboard uses the 'integer' type.

RETURNS DESCRIPTION
bool

True if score_type is "integer", else False.

has_scores

Python
has_scores() -> bool

Check if any scores are present.

RETURNS DESCRIPTION
bool

True if at least one score exists.

score_count

Python
score_count() -> int

Get the number of entities with scores.

RETURNS DESCRIPTION
int

Number of scores.

update_display_info

Python
update_display_info(
    display_text: str, score_type: str
) -> None

Update the scoreboard's display text and score type.

PARAMETER DESCRIPTION
display_text

New display text.

TYPE: str

score_type

New score type ("integer" or "hearts").

TYPE: str

set_displayed

Python
set_displayed(displayed: bool, position: int = -1) -> None

Mark this scoreboard as displayed or hidden.

PARAMETER DESCRIPTION
displayed

Whether the scoreboard is displayed.

TYPE: bool

position

Display position (0-18).

TYPE: int DEFAULT: -1

get_display_position_name

Python
get_display_position_name() -> str

Get a human-readable name for the display position.

RETURNS DESCRIPTION
str

Name of the display position (e.g., "sidebar", "team sidebar (color 5)").

is_team_sidebar

Python
is_team_sidebar() -> bool

Check if the scoreboard is displayed in a team sidebar.

RETURNS DESCRIPTION
bool

True if displayed in team sidebar (positions 3-18), else False.

get_top_scores

Python
get_top_scores(count: int = 10) -> List[Tuple[str, int]]

Get the top N scores.

PARAMETER DESCRIPTION
count

Number of top scores to return.

TYPE: int DEFAULT: 10

RETURNS DESCRIPTION
List[Tuple[str, int]]

List of (entity_name, score) tuples for the top scores.

get_bottom_scores

Python
get_bottom_scores(count: int = 10) -> List[Tuple[str, int]]

Get the bottom N scores.

PARAMETER DESCRIPTION
count

Number of bottom scores to return.

TYPE: int DEFAULT: 10

RETURNS DESCRIPTION
List[Tuple[str, int]]

List of (entity_name, score) tuples for the bottom scores.