Interface: Player
A live server player with player-specific inventory and messaging APIs.
Extends
Properties
dimension
readonlydimension:Dimension
Dimension currently containing the entity.
Inherited from
equipment
readonlyequipment:Equipment
Equipped item facade.
id
readonlyid:string
Stable runtime entity identifier.
Inherited from
inventory
readonlyinventory:PlayerInventory
Main player inventory facade.
isValid
readonlyisValid:boolean
Whether the underlying entity can still be accessed.
Inherited from
location
readonlylocation:Vector3
Current world-space location.
Inherited from
name
readonlyname:string
Current player name.
nameTag
nameTag:
string
Mutable custom name shown by Minecraft.
Inherited from
selectedSlotIndex
selectedSlotIndex:
number
Mutable selected hotbar slot index.
typeId
readonlytypeId:string
Namespaced entity type identifier.
Inherited from
uuid
readonlyuuid: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
extinguish()
extinguish():
void
Extinguishes the entity if it is on fire.
Returns
void
Inherited from
getGameMode()
getGameMode():
GameMode
Returns the player's current Java Edition game mode.
Returns
getTags()
getTags(): readonly
string[]
Returns a copy of all entity tags.
Returns
readonly string[]
Inherited from
giveItem()
giveItem(
itemStack):ItemStack|null
Adds a stack and returns the remainder that did not fit, if any.
Parameters
itemStack
Returns
ItemStack | null
hasTag()
hasTag(
tag):boolean
Returns whether the entity has a tag.
Parameters
tag
string
Returns
boolean
Inherited from
kill()
kill():
void
Applies the entity's normal lethal damage path.
Returns
void
Inherited from
remove()
remove():
void
Removes the entity without applying normal death behaviour.
Returns
void
Inherited from
removeTag()
removeTag(
tag):boolean
Removes an entity tag and reports whether it changed.
Parameters
tag
string
Returns
boolean
Inherited from
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
Returns
void
teleport()
teleport(
location,options?):void
Moves the entity to a location and optional destination dimension.
Parameters
location
options?
TeleportOptions | null
Returns
void