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

PlayerActor

Class to manipulate with separate players.

@remarks

It is temporary! Most methods works only 1 server tick!

Index

Constructors

constructor

Methods

addExperience

  • addExperience(amount: number): void
  • Add experience to player.


    Parameters

    • amount: number

    Returns void

addItemToInventory

  • addItemToInventory(id: number, count: number, data: number, extra: ItemExtraData, dropRemaining: boolean): void
  • 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

  • canFly(): boolean
  • @since

    2.3.1b116

    @remarks

    Server-side analogue of Player.getFlyingEnabled.


    Returns boolean

    true if player is allowed to fly, false otherwise.

getArmor


  • Parameters

    • slot: number

    Returns ItemInstance

    Armor slot's contents.

getDimension

  • getDimension(): number

  • Returns number

    ID of dimension where player is.

getExhaustion

  • getExhaustion(): number

  • Returns number

    Player's exhaustion.

getExperience

  • getExperience(): number

  • Returns number

    Player's experience.

getGameMode

  • getGameMode(): number

  • Returns number

    Player's gamemode.

getHunger

  • getHunger(): number

  • Returns number

    Player's hunger.

getInventorySlot


  • Parameters

    • slot: number

    Returns ItemInstance

    Inventory slot's contents.

getItemUseDuration

  • getItemUseDuration(): number
  • @since

    2.2.1b101 (TODO: fix in changelog)


    Returns number

getItemUseIntervalProgress

  • getItemUseIntervalProgress(): number
  • @since

    2.2.1b101 (TODO: fix in changelog)


    Returns number

getItemUseStartupProgress

  • getItemUseStartupProgress(): number
  • @since

    2.2.1b101 (TODO: fix in changelog)


    Returns number

getLevel

  • getLevel(): number

  • Returns number

    Player's xp level.

getPlayerBooleanAbility

  • getPlayerBooleanAbility(ability: string): boolean
  • Gets one of the player's abilities in a boolean form.

    @remarks

    Server-side analogue of Player.getBooleanAbility.

    @since

    2.3.1b116


    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

  • getPlayerFloatAbility(ability: string): number
  • Gets one of the player's abilities in a form of floating-point number.

    @remarks

    Server-side analogue of Player.getFloatAbility.

    @since

    2.3.1b116


    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

  • getPointer(): number
  • @since

    2.2.1b102


    Returns number

getSaturation

  • getSaturation(): number

  • Returns number

    Player's saturation.

getScore

  • getScore(): number

  • Returns number

    Player's score.

getSelectedSlot

  • getSelectedSlot(): number

  • Returns number

    Player's selected slot.

getUid

  • getUid(): number

  • Returns number

    Player's unique numeric entity ID.

isFlying

  • isFlying(): boolean
  • @since

    2.3.1b116

    @remarks

    Server-side analogue of Player.getFlying.


    Returns boolean

    true if player is flying, false otherwise.

isOperator

  • isOperator(): boolean
  • @since

    2.3.1b116


    Returns boolean

    true if player has operator permissions

isValid

  • isValid(): boolean
  • @since

    2.2.0b75 (not working before)


    Returns boolean

    Whether the player is a valid entity.

setArmor

  • setArmor(slot: number, id: number, count: number, data: number, extra: ItemExtraData): void
  • Sets armor slot's contents.


    Parameters

    • slot: number
    • id: number
    • count: number
    • data: number
    • extra: ItemExtraData

    Returns void

setCanFly

  • setCanFly(enabled: boolean): void
  • Enables or disables player's ability to fly.

    @since

    2.3.1b116

    @remarks

    Server-side analogue of Player.setFlyingEnabled.


    Parameters

    • enabled: boolean

      whether the player can fly or not

    Returns void

setExhaustion

  • setExhaustion(value: number): void
  • Sets player's exhaustion.


    Parameters

    • value: number

    Returns void

setExperience

  • setExperience(value: number): void
  • Sets player's experience.


    Parameters

    • value: number

    Returns void

setFlying

  • setFlying(enabled: boolean): void
  • Changes player's current flying state, call PlayerActor.setCanFly to be able to set this property to true.

    @since

    2.3.1b116

    @remarks

    Server-side analogue of Player.setFlying.


    Parameters

    • enabled: boolean

      whether the player should fly or not

    Returns void

setHunger

  • setHunger(value: number): void
  • Sets player's hunger.


    Parameters

    • value: number

    Returns void

setInventorySlot

  • setInventorySlot(slot: number, id: number, count: number, data: number, extra: ItemExtraData): void
  • Sets inventory slot's contents.


    Parameters

    • slot: number
    • id: number
    • count: number
    • data: number
    • extra: ItemExtraData

    Returns void

setLevel

  • setLevel(level: number): void
  • Sets player's xp level.


    Parameters

    • level: number

    Returns void

setPlayerBooleanAbility

  • setPlayerBooleanAbility(ability: string, value: boolean): void
  • Sets some of the player's abilities.

    @remarks

    Server-side analogue of Player.setAbility.

    @since

    2.3.1b116


    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

  • setPlayerFloatAbility(ability: string, value: number): void
  • Sets some of the player's abilities.

    @remarks

    Server-side analogue of Player.setAbility.

    @since

    2.3.1b116


    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

  • setRespawnCoords(x: number, y: number, z: number): void
  • Sets respawn coords for the player.


    Parameters

    • x: number
    • y: number
    • z: number

    Returns void

setSaturation

  • setSaturation(value: number): void
  • Sets player's saturation.


    Parameters

    • value: number

    Returns void

setScore

  • setScore(value: number): void
  • Sets player's score.


    Parameters

    • value: number

    Returns void

setSelectedSlot

  • setSelectedSlot(slot: number): void
  • Sets player's selected slot.


    Parameters

    • slot: number

    Returns void

spawnExpOrbs

  • spawnExpOrbs(x: number, y: number, z: number, value: number): void
  • Spawns exp on coords.


    Parameters

    • x: number
    • y: number
    • z: number
    • value: number

      experience points value

    Returns void