Interface FullPlayer

interface FullPlayer {
    _client: Client;
    behavior: ((eventName, data?, func?, cancelFunc?) => Promise<any>);
    bornTime: number;
    changeBlock: ((position, blockType, blockData) => Promise<void>);
    changeWorld: ((world, opt) => Promise<void>);
    chat: ((message) => void);
    deathTime?: number;
    displayXp: number;
    entityType: number;
    friction: any;
    getData: ((pluginName) => any);
    getNearby: (() => Entity[]);
    getNearbyPlayers: ((radius?) => Player[]);
    getOtherPlayers: (() => Player[]);
    getOthers: (() => Record<string, Entity>);
    gravity: any;
    handleCommand: ((str) => Promise<void>);
    headPitch: number;
    id: string;
    itemDamage?: number;
    itemId?: number;
    kick: ((reason?) => void);
    login: (() => Promise<void>);
    metadata: any;
    name?: string;
    nearbyEntities: Entity[];
    nearbyPlayers: ((radius?) => Player[]);
    pickupTime?: number;
    pitch: number;
    playSound: ((sound, opt?) => void);
    position: Vec3;
    save: (() => Promise<any>);
    sendBlock: ((position, blockStateId) => any);
    sendBlockAction: ((position, actionId, actionParam, blockType) => Promise<void>);
    sendBrand: ((brand?) => Promise<void>);
    sendXp: (() => void);
    setBlock: ((position, stateId) => any);
    setBlockAction: ((position, actionId, actionParam) => any);
    setDisplayXp: (() => void);
    setGameMode: ((gameMode) => void);
    setXp: ((xp, __namedParameters?) => void);
    setXpLevel: ((level) => void);
    size: Vec3;
    spawnPoint: Vec3;
    takeDamage: ((__namedParameters) => void);
    terminalvelocity: Vec3;
    type: string;
    updateFood: ((food) => void);
    updateFoodSaturation: ((foodSaturation) => void);
    updateHealth: ((health) => void);
    username: string;
    view: number;
    viewDistance: number;
    xp: number;
    xpLevel: number;
    yaw: number;
    [captureRejectionSymbol]?(error, event, ...args): void;
    addListener<E>(event, listener): this;
    emit<E>(event, ...args): boolean;
    eventNames(): (string | symbol)[];
    getMaxListeners(): number;
    listenerCount<E>(event): number;
    listeners<E>(event): Function[];
    off<E>(event, listener): this;
    on<E>(event, listener): this;
    once<E>(event, listener): this;
    prependListener<E>(event, listener): this;
    prependOnceListener<E>(event, listener): this;
    rawListeners<E>(event): Function[];
    removeAllListeners<E>(event?): this;
    removeListener<E>(event, listener): this;
    setMaxListeners(maxListeners): this;
}

Hierarchy

  • Player
    • FullPlayer

Properties

_client: Client
behavior: ((eventName, data?, func?, cancelFunc?) => Promise<any>)

Type declaration

    • (eventName, data?, func?, cancelFunc?): Promise<any>
    • Parameters

      • eventName: string
      • Optional data: any
      • Optional func: Function
      • Optional cancelFunc: Function

      Returns Promise<any>

bornTime: number

When an entity was born. Used with pickupTime and deathTime (time in epoch)

changeBlock: ((position, blockType, blockData) => Promise<void>)

change the block at position position to blockType and blockData

this will not change the block for the user himself. It is mainly useful when a user places a block and only needs to send it to other players on the server

Type declaration

    • (position, blockType, blockData): Promise<void>
    • change the block at position position to blockType and blockData

      this will not change the block for the user himself. It is mainly useful when a user places a block and only needs to send it to other players on the server

      Parameters

      • position: any
      • blockType: any
      • blockData: any

      Returns Promise<void>

changeWorld: ((world, opt) => Promise<void>)

The world object which the player is in (use serv.overworld, serv.netherworld, serv.endworld, or a custom world). Options:

  • gamemode: Gamemode of the world (Default is player gamemode)
  • difficulty: Difficulty of world. Default is 0 (easiest)
  • dimension: Dimension of world. 0 is Overworld, -1 is Nether, 1 is End (Default is 0)

Type declaration

    • (world, opt): Promise<void>
    • The world object which the player is in (use serv.overworld, serv.netherworld, serv.endworld, or a custom world). Options:

      • gamemode: Gamemode of the world (Default is player gamemode)
      • difficulty: Difficulty of world. Default is 0 (easiest)
      • dimension: Dimension of world. 0 is Overworld, -1 is Nether, 1 is End (Default is 0)

      Parameters

      • world: any
      • opt: any

      Returns Promise<void>

chat: ((message) => void)

sends message to the player

Type declaration

    • (message): void
    • sends message to the player

      Parameters

      • message: any

      Returns void

deathTime?: number

How much time before an entity despawns (in ms)

displayXp: number

Number from 0 to 1.0 representing the progress bar at the bottom of the player's screen. Set this with player.setDisplayXp()

entityType: number

Numerical type of the entity.

friction: any

Decreases velocity when touching blocks

getData: ((pluginName) => any)

Gets object that stores data, personalized per plugin. Returns null if plugin does not exist.

Shortcut for: entity.pluginData[pluginName];

Type declaration

    • (pluginName): any
    • Gets object that stores data, personalized per plugin. Returns null if plugin does not exist.

      Shortcut for: entity.pluginData[pluginName];

      Parameters

      • pluginName: any

      Returns any

getNearby: (() => Entity[])

Gets all entities nearby (within entity.viewDistance)

Type declaration

    • (): Entity[]
    • Gets all entities nearby (within entity.viewDistance)

      Returns Entity[]

getNearbyPlayers: ((radius?) => Player[])

Gets all nearby players regardless of what client thinks

Type declaration

    • (radius?): Player[]
    • Gets all nearby players regardless of what client thinks

      Parameters

      • Optional radius: number

      Returns Player[]

getOtherPlayers: (() => Player[])

Gets every player other than self (all players if entity is not a player)

Type declaration

    • (): Player[]
    • Gets every player other than self (all players if entity is not a player)

      Returns Player[]

getOthers: (() => Record<string, Entity>)

Get every other entity other than self Should not be used repeatedly as it is a slow operation

Type declaration

    • (): Record<string, Entity>
    • Get every other entity other than self Should not be used repeatedly as it is a slow operation

      Returns Record<string, Entity>

gravity: any

Gravity of entity (non-players) to calculate physics.

handleCommand: ((str) => Promise<void>)

handle command

Type declaration

    • (str): Promise<void>
    • handle command

      Parameters

      • str: string

      Returns Promise<void>

headPitch: number

Pitch of entity's head

id: string

ID of entity on server

itemDamage?: number

If a block drop, what item damage

itemId?: number

If a block drop, what item id

kick: ((reason?) => void)

kicks player with reason

Type declaration

    • (reason?): void
    • kicks player with reason

      Parameters

      • Optional reason: string

      Returns void

login: (() => Promise<void>)

login

Type declaration

    • (): Promise<void>
    • login

      Returns Promise<void>

metadata: any

Metadata for the entity (not like block metadata/damage). Contains stuff like NBT.

name?: string

Sub-category of entity. For mobs, this is which mob (Zombie/Skeleton, etc). For objects, this is which object (Arrow/Dropped item, etc)

nearbyEntities: Entity[]

List of entities that the entity believes is nearby.

nearbyPlayers: ((radius?) => Player[])

Gets all nearby players that client can see

Type declaration

    • (radius?): Player[]
    • Gets all nearby players that client can see

      Parameters

      • Optional radius: number

      Returns Player[]

pickupTime?: number

How long before an entity can be picked up (in ms)

pitch: number

Pitch of entity (rotation sideways)

playSound: ((sound, opt?) => void)

Easy way to only play a sound for one player. Same opt as serv.playSound except no whitelist.

Type declaration

    • (sound, opt?): void
    • Easy way to only play a sound for one player. Same opt as serv.playSound except no whitelist.

      Parameters

      • sound: any
      • Optional opt: {}

        Returns void

    position: Vec3

    Current position (currently in fixed position (x32 what you'd expect) so do entity.position.scaled(1/32) to get normal position)

    save: (() => Promise<any>)

    If worldFolder option is set, save player's data into <worldFolder>/playerdata/<UUID>.dat. Returns promise. Example: save all players data to disk:

    for (const player of serv.players) {
    player.save()
    }

    Type declaration

      • (): Promise<any>
      • If worldFolder option is set, save player's data into <worldFolder>/playerdata/<UUID>.dat. Returns promise. Example: save all players data to disk:

        for (const player of serv.players) {
        player.save()
        }

        Returns Promise<any>

    sendBlock: ((position, blockStateId) => any)

    change the block at position position to blockType and blockData

    this will not make any changes on the server's world and only sends it to the user as a "fake" or "local" block

    Type declaration

      • (position, blockStateId): any
      • change the block at position position to blockType and blockData

        this will not make any changes on the server's world and only sends it to the user as a "fake" or "local" block

        Parameters

        • position: any
        • blockStateId: any

        Returns any

    sendBlockAction: ((position, actionId, actionParam, blockType) => Promise<void>)

    Set the block action at position position to actionId and actionParam.

    blockType is only required when the block at the location is a fake block. This will only be caused by using player.sendBlock.

    This will not make any changes to the server's world and only sends it to the user as a local action.

    Type declaration

      • (position, actionId, actionParam, blockType): Promise<void>
      • Set the block action at position position to actionId and actionParam.

        blockType is only required when the block at the location is a fake block. This will only be caused by using player.sendBlock.

        This will not make any changes to the server's world and only sends it to the user as a local action.

        Parameters

        • position: any
        • actionId: any
        • actionParam: any
        • blockType: any

        Returns Promise<void>

    sendBrand: ((brand?) => Promise<void>)

    Send the specified brand to the player or flying-squid by default

    Type declaration

      • (brand?): Promise<void>
      • Send the specified brand to the player or flying-squid by default

        Parameters

        • Optional brand: string

        Returns Promise<void>

    sendXp: (() => void)

    Updates the player's xp based on player.xp, player.displayXp, and player.xpLevel

    Type declaration

      • (): void
      • Updates the player's xp based on player.xp, player.displayXp, and player.xpLevel

        Returns void

    setBlock: ((position, stateId) => any)

    Saves block in world and sends block update to all players of the same world.

    Type declaration

      • (position, stateId): any
      • Saves block in world and sends block update to all players of the same world.

        Parameters

        • position: any
        • stateId: any

        Returns any

    setBlockAction: ((position, actionId, actionParam) => any)

    Sets a block action and sends the block action to all players in the same world.

    This will not make any changes to the server's world

    Type declaration

      • (position, actionId, actionParam): any
      • Sets a block action and sends the block action to all players in the same world.

        This will not make any changes to the server's world

        Parameters

        • position: any
        • actionId: any
        • actionParam: any

        Returns any

    setDisplayXp: (() => void)

    Sets and sends the player's new display amount. num should be from 0 to 1.0

    Type declaration

      • (): void
      • Sets and sends the player's new display amount. num should be from 0 to 1.0

        Returns void

    setGameMode: ((gameMode) => void)

    set player gameMode to gameMode

    Type declaration

      • (gameMode): void
      • set player gameMode to gameMode

        Parameters

        • gameMode: any

        Returns void

    setXp: ((xp, __namedParameters?) => void)

    Sets the player's XP level. Options:

    • setLevel: Calculate and set player.level (default: true)
    • setDisplay: Calculate and set player.displayXp (default: true)
    • send: Send xp packet (default: true)

    Type declaration

      • (xp, __namedParameters?): void
      • Sets the player's XP level. Options:

        • setLevel: Calculate and set player.level (default: true)
        • setDisplay: Calculate and set player.displayXp (default: true)
        • send: Send xp packet (default: true)

        Parameters

        • xp: any
        • Optional __namedParameters: {
              send?: boolean;
              setDisplay?: boolean;
              setLevel?: boolean;
          }
          • Optional send?: boolean
          • Optional setDisplay?: boolean
          • Optional setLevel?: boolean

        Returns void

    setXpLevel: ((level) => void)

    Sets and sends the player's new level

    Type declaration

      • (level): void
      • Sets and sends the player's new level

        Parameters

        • level: any

        Returns void

    size: Vec3

    Used to calculate collisions for server-side entities

    spawnPoint: Vec3

    Either serv.spawnPoint or randomly selected for each player. Possibly could be overridden in future (e.g. beds or anchors), serv global serv.spawnPoint should as fallback

    takeDamage: ((__namedParameters) => void)

    sound: Sound to play (default is game.player.hurt)

    • damage: Damage to deal (default is based off player's weapon, player's potions, attackEntity's potions, and attackedEntity armor)
    • velocity: Which way should attackedEntity move when hit
    • maxVelocity: maxVelocity from consecutive hits
    • animation: Play death/hit animation

    Type declaration

      • (__namedParameters): void
      • sound: Sound to play (default is game.player.hurt)

        • damage: Damage to deal (default is based off player's weapon, player's potions, attackEntity's potions, and attackedEntity armor)
        • velocity: Which way should attackedEntity move when hit
        • maxVelocity: maxVelocity from consecutive hits
        • animation: Play death/hit animation

        Parameters

        • __namedParameters: {
              animation?: boolean;
              damage?: number;
              maxVelocity?: any;
              sound?: string;
              velocity?: any;
          }
          • Optional animation?: boolean
          • Optional damage?: number
          • Optional maxVelocity?: any
          • Optional sound?: string
          • Optional velocity?: any

        Returns void

    terminalvelocity: Vec3

    Only applies to gravity, really. You can still apply a velocity larger than terminal velocity.

    type: string

    Either "player", "mob", or "object" (currently)

    updateFood: ((food) => void)

    Updates the player's food and sends the relevant packet.

    Type declaration

      • (food): void
      • Updates the player's food and sends the relevant packet.

        Parameters

        • food: number

        Returns void

    updateFoodSaturation: ((foodSaturation) => void)

    Updates the player's food saturation and sends the relevant packet.

    Type declaration

      • (foodSaturation): void
      • Updates the player's food saturation and sends the relevant packet.

        Parameters

        • foodSaturation: number

        Returns void

    updateHealth: ((health) => void)

    Updates the player's health and sends the relevant packet.

    Type declaration

      • (health): void
      • Updates the player's health and sends the relevant packet.

        Parameters

        • health: number

        Returns void

    username: string

    The username of the player

    view: number

    The view size of the player, for example 8 for 16x16

    viewDistance: number

    How far away entities are loaded/unloaded (used for players ATM)

    xp: number

    Total experience the player has (int). Set this using player.setXp()

    xpLevel: number

    Level of xp the player has. Set this with player.setXpLevel()

    yaw: number

    Yaw of entity (rotation looking up and down)

    Methods

    • Parameters

      • error: Error
      • event: string
      • Rest ...args: any[]

      Returns void

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • Rest ...args: Arguments<PlayerEvents[E]>

      Returns boolean

    • Returns (string | symbol)[]

    • Returns number

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E

      Returns number

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E

      Returns Function[]

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E

      Returns Function[]

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • Optional event: E

      Returns this

    • Type Parameters

      • E extends keyof PlayerEvents

      Parameters

      • event: E
      • listener: PlayerEvents[E]

      Returns this

    • Parameters

      • maxListeners: number

      Returns this

    Generated using TypeDoc