Class Player

Represent a world's player

Hierarchy

Constructors

Properties

inventory: { clear: ((item?: string | gameTag, max?: number) => string); give: ((item: string, count?: number, itemsData?: NBTData) => string); place: ((slot: number, item: string, count?: number) => string) } = ...

Manage the entity's inventory

Type declaration

  • clear: ((item?: string | gameTag, max?: number) => string)
      • (item?: string | gameTag, max?: number): string
      • Clear an item or the total entity's inventory

        Parameters

        • Optional item: string | gameTag

          The item to remove (if unset, will clear all the entity's inventory)

        • Optional max: number

          The maximum of this item to clear

        Returns string

  • give: ((item: string, count?: number, itemsData?: NBTData) => string)
      • (item: string, count?: number, itemsData?: NBTData): string
      • Give an item to the entity

        Parameters

        • item: string

          The item to give

        • Optional count: number

          The amount of this item to give (default: 1)

        • Optional itemsData: NBTData

          The data of this item

        Returns string

  • place: ((slot: number, item: string, count?: number) => string)
      • (slot: number, item: string, count?: number): string
      • Place an item in a specific slot of the entity's inventory

        Note

        You can use the PlayerInventorySlots slot variable to help you choosing the slot's number

        Parameters

        • slot: number

          The slot's number to set the item in

        • item: string

          The item

        • Optional count: number

          The amount of this item to set

        Returns string

nbt: { get: ((path?: NBTPath, scale?: number) => string); set: ((value: string | number | NBTData, path?: NBTPath) => string); store: ((path: NBTPath, type: "success" | "result", scale: number, from: string) => string) } = ...

Manage the entity's nbt

Type declaration

  • get: ((path?: NBTPath, scale?: number) => string)
      • (path?: NBTPath, scale?: number): string
      • Get a nbt of this entity

        Parameters

        • Optional path: NBTPath

          The path to the entity's NBT

        • Optional scale: number

          The scale to multiply the request NBT after get it

        Returns string

  • set: ((value: string | number | NBTData, path?: NBTPath) => string)
      • (value: string | number | NBTData, path?: NBTPath): string
      • Set a nbt for this entity

        Parameters

        • value: string | number | NBTData

          The value to set to this NBT

        • Optional path: NBTPath

          The path to the entity's NBT

        Returns string

  • store: ((path: NBTPath, type: "success" | "result", scale: number, from: string) => string)
      • (path: NBTPath, type: "success" | "result", scale: number, from: string): string
      • Store data from a command

        Parameters

        • path: NBTPath

          The path to the entity's NBT

        • type: "success" | "result"

          The type of result you want:
          success: If the command has been correcly executed, it will returns 1, else 0
          result: Will returns the callback of the executed command

        • scale: number
        • from: string

          The command

        Returns string

selector: selector
tags: { add: ((...names: string[]) => Commands); remove: ((...names: string[]) => Commands); replace: ((from: string, to: string) => Commands) } = ...

Manage the entity's tags

Type declaration

  • add: ((...names: string[]) => Commands)
      • (...names: string[]): Commands
      • Add tags to the entity

        Parameters

        • Rest ...names: string[]

        Returns Commands

  • remove: ((...names: string[]) => Commands)
      • (...names: string[]): Commands
      • Remove tags to the entity

        Parameters

        • Rest ...names: string[]

        Returns Commands

  • replace: ((from: string, to: string) => Commands)
      • (from: string, to: string): Commands
      • Replace a tag to the entity

        Parameters

        • from: string

          The tag to replace

        • to: string

          The tag to replace with

        Returns Commands

Methods

  • Execute a command with the entity aligned on the block where it is

    Parameters

    • x: boolean

      If the execution will be aligned on the x axis

    • y: boolean

      If the execution will be aligned on the y axis

    • z: boolean

      If the execution will be aligned on the z axis

    • command: string

      The command to execute

    Returns string

  • Ban the player of the server

    Parameters

    • Optional reason: string

      The reason the player has been banned for

    Returns string

  • Kick the player of the server/map

    Parameters

    • Optional reason: string

      The reason the player has been kicked for

    Returns string

  • Set the player operator or not

    Parameters

    • op: boolean

      If the player is an operator

    Returns string

  • If the entity isn't a "player-type", spawn it at the given location

    Parameters

    • position: Block

      The position where the entity will spawn

    • Optional nbt: NBTData

      Custom nbt to give to the entity when spawning

    Returns string

  • Teleport the/an entity somewhere

    Parameters

    • location: coordonate | Entity | "self"

      The location where the entity will be teleported

    • Optional entity: Entity

      The entity to teleport (if unset, it will take this entity)

    • Optional facing: { entity: Entity; face?: "eyes" | "feet" } | { value: [string | number | Position, string | number | Position] }

      The rotation of the entity

    Returns string

Generated using TypeDoc