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 |
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 |
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 |
scoreboard |
Scoreboard
|
The player's visible |
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. |
allow_flight
property
writable
¶
allow_flight: bool
Whether the Player is allowed to fly via jump key double-tap.
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.
inventory
property
¶
inventory: PlayerInventory
The player's inventory. This also contains the armor slots.
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.
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.
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.
walk_speed
property
writable
¶
walk_speed: float
The current allowed speed that a client can walk. Default is 0.10.
get_ability
¶
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
¶
kick
¶
kick(message: str) -> None
Kicks player with custom kick message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Kick message. |
required |
open_sign
¶
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
¶
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
¶
play_sound
¶
reset_title
¶
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
¶
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_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
¶
show_actor
¶
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
¶
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
¶
update_commands
¶
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. |
endstone.Skin
¶
Skin(
id: str,
image: NDArray[uint8],
cape_id: str | None = None,
cape_image: NDArray[uint8] | None = None,
)