PlayerActor
Index
Constructors
Methods
- addExperience
- addItemToInventory
- canFly
- getArmor
- getDimension
- getExhaustion
- getExperience
- getGameMode
- getHunger
- getInventorySlot
- getItemUseDuration
- getItemUseIntervalProgress
- getItemUseStartupProgress
- getLevel
- getPlayerBooleanAbility
- getPlayerFloatAbility
- getPointer
- getSaturation
- getScore
- getSelectedSlot
- getUid
- isFlying
- isOperator
- isValid
- setArmor
- setCanFly
- setExhaustion
- setExperience
- setFlying
- setHunger
- setInventorySlot
- setLevel
- setPlayerBooleanAbility
- setPlayerFloatAbility
- setRespawnCoords
- setSaturation
- setScore
- setSelectedSlot
- spawnExpOrbs
Constructors
constructor
Parameters
playerUid: number
Returns PlayerActor
Methods
addExperience
Add experience to player.
Parameters
amount: number
Returns void
addItemToInventory
Adds item to player's inventory.
Parameters
id: number
count: number
data: number
extra: ItemExtraData
dropRemaining: boolean
if true, surplus will be dropped near player
Returns void
canFly
Returns boolean
true
if player is allowed to fly,false
otherwise.
getArmor
Parameters
slot: number
Returns ItemInstance
Armor slot's contents.
getDimension
Returns number
ID of dimension where player is.
getExhaustion
Returns number
Player's exhaustion.
getExperience
Returns number
Player's experience.
getGameMode
Returns number
Player's gamemode.
getHunger
Returns number
Player's hunger.
getInventorySlot
Parameters
slot: number
Returns ItemInstance
Inventory slot's contents.
getItemUseDuration
Returns number
getItemUseIntervalProgress
Returns number
getItemUseStartupProgress
Returns number
getLevel
Returns number
Player's xp level.
getPlayerBooleanAbility
Gets one of the player's abilities in a boolean form.
Parameters
ability: string
ability name constant, should be one of the EPlayerAbility constants
Returns boolean
Current value of the ability in a boolean form.
getPlayerFloatAbility
Gets one of the player's abilities in a form of floating-point number.
Parameters
ability: string
ability name constant, should be one of the EPlayerAbility constants
Returns number
Current value of the ability in a form of floating-point number.
getPointer
Returns number
getSaturation
Returns number
Player's saturation.
getScore
Returns number
Player's score.
getSelectedSlot
Returns number
Player's selected slot.
getUid
Returns number
Player's unique numeric entity ID.
isFlying
Returns boolean
true
if player is flying,false
otherwise.
isOperator
Returns boolean
true
if player has operator permissions
isValid
Returns boolean
Whether the player is a valid entity.
setArmor
Sets armor slot's contents.
Parameters
slot: number
id: number
count: number
data: number
extra: ItemExtraData
Returns void
setCanFly
Enables or disables player's ability to fly.
Parameters
enabled: boolean
whether the player can fly or not
Returns void
setExhaustion
Sets player's exhaustion.
Parameters
value: number
Returns void
setExperience
Sets player's experience.
Parameters
value: number
Returns void
setFlying
Changes player's current flying state, call PlayerActor.setCanFly to be able to set this property to
true
.Parameters
enabled: boolean
whether the player should fly or not
Returns void
setHunger
Sets player's hunger.
Parameters
value: number
Returns void
setInventorySlot
Sets inventory slot's contents.
Parameters
slot: number
id: number
count: number
data: number
extra: ItemExtraData
Returns void
setLevel
Sets player's xp level.
Parameters
level: number
Returns void
setPlayerBooleanAbility
Sets some of the player's abilities.
Parameters
ability: string
ability name constant, should be one of the EPlayerAbility constants
value: boolean
the value to be set for the ability
Returns void
setPlayerFloatAbility
Sets some of the player's abilities.
Parameters
ability: string
ability name constant, should be one of the EPlayerAbility constants
value: number
the value to be set for the ability
Returns void
setRespawnCoords
Sets respawn coords for the player.
Parameters
x: number
y: number
z: number
Returns void
setSaturation
Sets player's saturation.
Parameters
value: number
Returns void
setScore
Sets player's score.
Parameters
value: number
Returns void
setSelectedSlot
Sets player's selected slot.
Parameters
slot: number
Returns void
spawnExpOrbs
Spawns exp on coords.
Parameters
x: number
y: number
z: number
value: number
experience points value
Returns void
Class to manipulate with separate players.
It is temporary! Most methods works only 1 server tick!