Skip to content

Player

endstone.Player

Bases: Mob

Represents a player.

Methods:

Name Description
can_see
close_form

Closes the forms that are currently open for the player.

get_ability
give_exp

Gives the player the amount of experience specified.

give_exp_levels

Gives the player the amount of experience levels specified.

hide_actor

Hides an actor from this player.

kick

Kicks player with custom kick message.

open_sign

Opens a sign editor for this player.

open_virtual_sign

Opens a sign editor for this player at the given block location.

perform_command

Makes the player perform the given command.

play_sound

Play a sound for a player at the location.

reset_title

Resets the title displayed to the player.

send_action_bar

Sends this player an action bar message.

send_block_change

Sends a block change to this player.

send_block_update

Sends a block entity state change to this player.

send_form

Sends a form to the player.

send_map

Render a map and send it to the player in its entirety.

send_packet

Sends a packet to the player.

send_popup

Sends this player a popup message.

send_tip

Sends this player a tip message.

send_title

Sends a title and a subtitle message to the player.

send_toast

Sends this player a toast notification.

set_ability
show_actor

Allows this player to see an actor that was previously hidden.

spawn_particle
stop_all_sounds

Stop all sounds from playing.

stop_sound

Stop the specified sound from playing.

transfer

Transfers the player to another server.

update_commands

Send the list of commands to the client.

Attributes:

Name Type Description
address SocketAddress

The socket address of this player.

allow_flight bool

Whether the Player is allowed to fly via jump key double-tap.

device_id str

The player's current device id.

device_os str

The player's current device's operation system (OS).

ender_chest Inventory

The player's EnderChest inventory.

exp_level int

The player's current experience level.

exp_progress float

The player's current experience progress towards the next level.

fly_speed float

The current allowed speed that a client can fly. Default is 0.05.

game_mode GameMode

The player's current GameMode.

game_version str

The player's current game version.

inventory PlayerInventory

The player's inventory. This also contains the armor slots.

is_crawling bool

Whether the player is currently crawling or not.

is_flying bool

Whether the player is currently flying or not.

is_op bool

Whether this player is a server operator.

is_sneaking bool

Whether the player is in sneak mode.

is_sprinting bool

Whether the player is sprinting or not.

locale str

The player's current locale.

name str

The name of this player.

ping int

The player's average ping in milliseconds.

respawn_location Location | None

The location where the player will respawn, or None if they don't have a valid respawn point.

scoreboard Scoreboard

The player's visible Scoreboard.

skin Skin

The player's skin.

total_exp int

The player's total experience points.

unique_id UUID

The UUID of this player.

walk_speed float

The current allowed speed that a client can walk. Default is 0.10.

xuid str

The Xbox User ID (XUID) of this player.

address property

address: SocketAddress

The socket address of this player.

allow_flight property writable

allow_flight: bool

Whether the Player is allowed to fly via jump key double-tap.

device_id property

device_id: str

The player's current device id.

device_os property

device_os: str

The player's current device's operation system (OS).

ender_chest property

ender_chest: Inventory

The player's EnderChest inventory.

exp_level property writable

exp_level: int

The player's current experience level.

exp_progress property writable

exp_progress: float

The player's current experience progress towards the next level.

This is a percentage value. 0.0 is "no progress" and 1.0 is "next level".

fly_speed property writable

fly_speed: float

The current allowed speed that a client can fly. Default is 0.05.

game_mode property writable

game_mode: GameMode

The player's current GameMode.

game_version property

game_version: str

The player's current game version.

inventory property

inventory: PlayerInventory

The player's inventory. This also contains the armor slots.

is_crawling property

is_crawling: bool

Whether the player is currently crawling or not.

is_flying property writable

is_flying: bool

Whether the player is currently flying or not.

is_op property writable

is_op: bool

Whether this player is a server operator.

is_sneaking property writable

is_sneaking: bool

Whether the player is in sneak mode.

is_sprinting property writable

is_sprinting: bool

Whether the player is sprinting or not.

locale property

locale: str

The player's current locale.

name property

name: str

The name of this player.

May be an empty string if we have not seen a name for this player yet.

ping property

ping: int

The player's average ping in milliseconds.

respawn_location property writable

respawn_location: Location | None

The location where the player will respawn, or None if they don't have a valid respawn point.

Assigning None clears the respawn point. When a location is assigned, its dimension must be loaded.

Note

Only the block coordinates and the dimension are written back; Bedrock does not persist yaw/pitch for a respawn point.

scoreboard property writable

scoreboard: Scoreboard

The player's visible Scoreboard.

skin property

skin: Skin

The player's skin.

total_exp property

total_exp: int

The player's total experience points.

This refers to the total amount of experience the player has collected over time and is not currently displayed to the client.

unique_id property

unique_id: UUID

The UUID of this player.

walk_speed property writable

walk_speed: float

The current allowed speed that a client can walk. Default is 0.10.

xuid property

xuid: str

The Xbox User ID (XUID) of this player.

can_see

can_see(actor: Actor) -> bool
can_see(player: Player) -> bool

close_form

close_form() -> None

Closes the forms that are currently open for the player.

get_ability

get_ability(ability: Identifier[Ability[_T]]) -> _T
get_ability(ability: str) -> bool | float

give_exp

give_exp(amount: int) -> None

Gives the player the amount of experience specified.

Parameters:

Name Type Description Default
amount int

Exp amount to give.

required

give_exp_levels

give_exp_levels(amount: int) -> None

Gives the player the amount of experience levels specified.

Parameters:

Name Type Description Default
amount int

Amount of experience levels to give or take.

required

hide_actor

hide_actor(plugin: Plugin, actor: Actor) -> None

Hides an actor from this player.

Parameters:

Name Type Description Default
plugin Plugin

Plugin that wants to hide the actor.

required
actor Actor

Actor to hide.

required

kick

kick(message: str) -> None

Kicks player with custom kick message.

Parameters:

Name Type Description Default
message str

Kick message.

required

open_sign

open_sign(sign: Sign, side: Side) -> None

Opens a sign editor for this player.

The sign must be placed in the same dimension as this player.

Parameters:

Name Type Description Default
sign Sign

The sign to open.

required
side Side

The side of the sign to edit.

required

Raises:

Type Description
ValueError

If the sign is not placed or is in another dimension.

open_virtual_sign

open_virtual_sign(location: Location, side: Side) -> None

Opens a sign editor for this player at the given block location.

No sign has to exist in the dimension: the caller is responsible for sending the client a sign block at that position first. Only the block coordinates of the location are used, the client may refuse a position that is too far away, and PlayerOpenSignEvent is not called.

Parameters:

Name Type Description Default
location Location

The block location of the sign.

required
side Side

The side of the sign to edit.

required

perform_command

perform_command(command: str) -> bool

Makes the player perform the given command.

Parameters:

Name Type Description Default
command str

Command to perform.

required

Returns:

Type Description
bool

True if the command was successful, False otherwise.

play_sound

play_sound(
    location: Location,
    sound: str,
    volume: float = 1.0,
    pitch: float = 1.0,
) -> None

Play a sound for a player at the location.

Parameters:

Name Type Description Default
location Location

The location to play the sound.

required
sound str

The internal sound name to play.

required
volume float

The volume of the sound.

1.0
pitch float

The pitch of the sound.

1.0

reset_title

reset_title() -> None

Resets the title displayed to the player.

This will clear the displayed title / subtitle and reset timings to their default values.

send_action_bar

send_action_bar(message: str) -> None

Sends this player an action bar message.

Parameters:

Name Type Description Default
message str

Message to be displayed.

required

send_block_change

send_block_change(
    location: Location, block: BlockData
) -> None

Sends a block change to this player.

This fakes a block change packet for a user at a certain location. This will not actually change the world in any way.

Parameters:

Name Type Description Default
location Location

The location of the changed block.

required
block BlockData

The new block data.

required

send_block_update

send_block_update(
    location: Location, block_actor_state: BlockActorState
) -> None

Sends a block entity state change to this player.

This fakes a block entity state change for a user at the given location. This will not actually change the world in any way.

The state is sent only to this player and does not update the world.

Parameters:

Name Type Description Default
location Location

The location of the changed block.

required
block_actor_state BlockActorState

The new block entity state.

required

send_form

send_form(
    form: MessageForm | ActionForm | ModalForm,
) -> None

Sends a form to the player.

Parameters:

Name Type Description Default
form MessageForm | ActionForm | ModalForm

The form to send.

required

send_map

send_map(map: MapView) -> None

Render a map and send it to the player in its entirety.

This may be used when streaming the map in the normal manner is not desirable.

Parameters:

Name Type Description Default
map MapView

The map to send.

required

send_packet

send_packet(packet_id: int, payload: bytes) -> None

Sends a packet to the player.

Parameters:

Name Type Description Default
packet_id int

The packet ID to be sent.

required
payload bytes

The payload of the packet to be transmitted.

required

send_popup

send_popup(message: str) -> None

Sends this player a popup message.

Parameters:

Name Type Description Default
message str

Message to be displayed.

required

send_tip

send_tip(message: str) -> None

Sends this player a tip message.

Parameters:

Name Type Description Default
message str

Message to be displayed.

required

send_title

send_title(
    title: str,
    subtitle: str,
    fade_in: int = 10,
    stay: int = 70,
    fade_out: int = 20,
) -> None

Sends a title and a subtitle message to the player.

If they are empty strings, the display will be updated as such.

Parameters:

Name Type Description Default
title str

Title text.

required
subtitle str

Subtitle text.

required
fade_in int

Time in ticks for titles to fade in. Defaults to 10.

10
stay int

Time in ticks for titles to stay. Defaults to 70.

70
fade_out int

Time in ticks for titles to fade out. Defaults to 20.

20

send_toast

send_toast(title: str, content: str) -> None

Sends this player a toast notification.

Parameters:

Name Type Description Default
title str

The title of the toast notification.

required
content str

The content of the toast notification.

required

set_ability

set_ability(
    ability: Identifier[Ability[_T]], value: _T
) -> None
set_ability(ability: str, value: bool | float) -> None

show_actor

show_actor(plugin: Plugin, actor: Actor) -> None

Allows this player to see an actor that was previously hidden.

If another plugin had hidden the actor too, the actor will remain hidden until the other plugin calls this method too.

Parameters:

Name Type Description Default
plugin Plugin

Plugin that wants to show the actor.

required
actor Actor

Actor to show.

required

spawn_particle

spawn_particle(
    name: str,
    location: Location,
    molang_variables: JsonObject | None = None,
) -> None
spawn_particle(
    name: str,
    x: float,
    y: float,
    z: float,
    molang_variables: JsonObject | None = None,
) -> None

stop_all_sounds

stop_all_sounds() -> None

Stop all sounds from playing.

stop_sound

stop_sound(sound: str) -> None

Stop the specified sound from playing.

Parameters:

Name Type Description Default
sound str

The sound to stop.

required

transfer

transfer(host: str, port: int = 19132) -> None

Transfers the player to another server.

Parameters:

Name Type Description Default
host str

Server address to transfer the player to.

required
port int

Server port to transfer the player to.

19132

update_commands

update_commands() -> None

Send the list of commands to the client.

Generally useful to ensure the client has a complete list of commands after permission changes are done.

endstone.OfflinePlayer

Represents a reference to a player identity and the data belonging to a player that is stored on the disk and can, thus, be retrieved without the player needing to be online.

Attributes:

Name Type Description
name str

The name of this player.

unique_id UUID

The UUID of this player.

name property

name: str

The name of this player.

Names are no longer unique past a single game session. For persistent storage it is recommended that you use unique_id instead. May be an empty string if we have not seen a name for this player yet.

unique_id property

unique_id: UUID

The UUID of this player.

endstone.Skin

Skin(
    id: str,
    image: NDArray[uint8],
    cape_id: str | None = None,
    cape_image: NDArray[uint8] | None = None,
)

Represents a player skin.

Attributes:

Name Type Description
cape_id str | None

The cape id.

cape_image NDArray[uint8]

The cape image.

id str

The skin id.

image NDArray[uint8]

The skin image.

cape_id property

cape_id: str | None

The cape id.

cape_image property

cape_image: NDArray[uint8]

The cape image.

id property

id: str

The skin id.

image property

image: NDArray[uint8]

The skin image.