player Namespace

Functions in this namespace are related to the state of the current player.

Note

These functions are not available for biome condition scripts.

Boolean player.isCreative()

Evaluates whether the player is in creative mode.

Returns:

true if the player is in creative mode, false otherwise.

Return type:

Boolean

Boolean player.isBurning()

Evaluates whether the player is isBurning

Returns:

true if the player is burning, false otherwise.

Return type:

Boolean

Boolean player.isSuffocating()

Evaluates whether the player is suffocating.

Returns:

true if the player is suffocating, false otherwise.

Return type:

Boolean

Boolean player.isFlying()

Evaluates whether the player is flying.

Returns:

true if the player is flying, false otherwise.

Return type:

Boolean

Boolean player.isSprinting()

Evaluates whether the player is sprinting.

Returns:

true if the player is sprinting, false otherwise.

Return type:

Boolean

Boolean player.isInLava()

Evaluates whether the player is located within lava.

Returns:

true if the player is in lava, false otherwise.

Return type:

Boolean

Boolean player.isInvisible()

Evaluates whether the player is invisible.

Returns:

true if the player is invisible, false otherwise.

Return type:

Boolean

Boolean player.isInWater()

Evaluates whether the player is in water.

Returns:

true if the player is in water, false otherwise.

Return type:

Boolean

Boolean player.isMoving()

Evaluates whether the player is moving, false otherwise. :rtype: Boolean

Boolean player.isWet()

Evaluates whether the player is wet.

Returns:

true if the player is wet, false otherwise.

Return type:

Boolean

Boolean player.isRiding()

Evaluates whether the player is riding an entity such as a horse or minecart.

Returns:

true if the player is riding, false otherwise.

Return type:

Boolean

Boolean player.isOnGround()

Evaluates whether the player is on the ground.

Returns:

true if the player is on the ground, false otherwise.

Return type:

Boolean

Boolean player.canRainOn()

Evaluates whether the player is in the open where rain can fall on them.

Returns:

true if the player can be rained on, false otherwise.

Return type:

Boolean

Boolean player.canSeeSky()

Evaluates whether the player is able to see the sky when looking up.

Returns:

true if the player can see the sky, false otherwise.

Return type:

Boolean

Float player.getHealth()

Gets the current health of the player.

Returns:

Player’s current health

Return type:

Float

Float player.getMaxHealth()

Gets the players maximum possible health value.

Returns:

Player’s maximum health

Return type:

Float

Float player.getFoodLevel()

Gets the players current food level.

Returns:

Player’s current food level

Return type:

Float

Float player.getFoodSaturationLevel()

Gets the player’s current food saturation level.

Returns:

Player’s current food saturation level.

Return type:

Float

Double player.getX()

Gets the X value of the player’s current block position.

Returns:

X value of the block position of the player

Return type:

Double

Double player.getY()

Gets the Y value of the player’s current block position.

Returns:

Y value of the block position of the player

Return type:

Double

Double player.getZ()

Gets the Z value of the player’s current block position.

Returns:

Z value of the block position of the player

Return type:

Double

Boolean player.hasEffect(String effect)

Evaluates whether the player has the specified effect. The effect is expressed as a resource location ID.

Arguments:
  • effect (String()) – The effect to check for

Returns:

Returns true if the player has the given effect, false otherwise.

Return type:

Boolean