Skip to content

Player

endstone.Player

Bases: Mob

Represents a player.

Methods:

Name Description
close_form

Closes the forms that are currently open for the player.

give_exp

Gives the player the amount of experience specified.

give_exp_levels

Gives the player the amount of experience levels specified.

kick

Kicks player with custom kick message.

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_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.

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_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.

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_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.

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.

close_form

close_form() -> None

Closes the forms that are currently open for the player.

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

kick

kick(message: str) -> None

Kicks player with custom kick message.

Parameters:

Name Type Description Default
message str

Kick message.

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_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

spawn_particle

spawn_particle(
    name: str,
    location: Location,
    molang_variables_json: str | None = None,
) -> None
spawn_particle(
    name: str,
    x: float,
    y: float,
    z: float,
    molang_variables_json: str | 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.