Перейти к основному содержимому

Interface: Player

A live server player with player-specific inventory and messaging APIs.

Extends

Properties

dimension

readonly dimension: Dimension

Dimension currently containing the entity.

Inherited from

Entity.dimension


equipment

readonly equipment: Equipment

Equipped item facade.


id

readonly id: string

Stable runtime entity identifier.

Inherited from

Entity.id


inventory

readonly inventory: PlayerInventory

Main player inventory facade.


isValid

readonly isValid: boolean

Whether the underlying entity can still be accessed.

Inherited from

Entity.isValid


location

readonly location: Vector3

Current world-space location.

Inherited from

Entity.location


name

readonly name: string

Current player name.


nameTag

nameTag: string

Mutable custom name shown by Minecraft.

Inherited from

Entity.nameTag


selectedSlotIndex

selectedSlotIndex: number

Mutable selected hotbar slot index.


typeId

readonly typeId: string

Namespaced entity type identifier.

Inherited from

Entity.typeId


uuid

readonly uuid: string

Stable player UUID string.

Methods

addTag()

addTag(tag): boolean

Adds a scoreboard-style entity tag and reports whether it changed.

Parameters

tag

string

Returns

boolean

Inherited from

Entity.addTag


extinguish()

extinguish(): void

Extinguishes the entity if it is on fire.

Returns

void

Inherited from

Entity.extinguish


getGameMode()

getGameMode(): GameMode

Returns the player's current Java Edition game mode.

Returns

GameMode


getTags()

getTags(): readonly string[]

Returns a copy of all entity tags.

Returns

readonly string[]

Inherited from

Entity.getTags


giveItem()

giveItem(itemStack): ItemStack | null

Adds a stack and returns the remainder that did not fit, if any.

Parameters

itemStack

ItemStack

Returns

ItemStack | null


hasTag()

hasTag(tag): boolean

Returns whether the entity has a tag.

Parameters

tag

string

Returns

boolean

Inherited from

Entity.hasTag


kill()

kill(): void

Applies the entity's normal lethal damage path.

Returns

void

Inherited from

Entity.kill


remove()

remove(): void

Removes the entity without applying normal death behaviour.

Returns

void

Inherited from

Entity.remove


removeTag()

removeTag(tag): boolean

Removes an entity tag and reports whether it changed.

Parameters

tag

string

Returns

boolean

Inherited from

Entity.removeTag


sendMessage()

sendMessage(message): void

Sends a chat message to this player.

Parameters

message

string

Returns

void


setGameMode()

setGameMode(gameMode): void

Changes the player's Java Edition game mode.

Parameters

gameMode

GameMode

Returns

void


teleport()

teleport(location, options?): void

Moves the entity to a location and optional destination dimension.

Parameters

location

Vector3Like

options?

TeleportOptions | null

Returns

void

Inherited from

Entity.teleport