Protocol: Player
A live server player with inventory and messaging APIs.
class Player(Entity, Protocol)
Related API: Entity, Equipment, GameMode, ItemStack, PlayerInventory
Properties
selected_slot_index
selected_slot_index: int
Mutable selected hotbar slot index.
name
@property
def name(self) -> str:
Current player name.
uuid
@property
def uuid(self) -> str:
Stable player UUID string.
inventory
@property
def inventory(self) -> PlayerInventory:
Main player inventory facade.
Related API: PlayerInventory
equipment
@property
def equipment(self) -> Equipment:
Equipped item facade.
Related API: Equipment
Methods
send_message
def send_message(self, message: str) -> None:
Send a chat message to this player.
set_game_mode
def set_game_mode(self, game_mode: GameMode) -> None:
Change the player's Java Edition game mode.
Related API: GameMode
get_game_mode
def get_game_mode(self) -> GameMode:
Return the player's current Java Edition game mode.
Related API: GameMode
give_item
def give_item(self, item_stack: ItemStack) -> Optional[ItemStack]:
Add a stack and return the remainder that did not fit, if any.
Related API: ItemStack