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

NetworkClient

Class that represents network client.

Index

Constructors

constructor

Methods

disconnect

  • disconnect(reason: string): void
  • disconnect(): void
  • Disconnects player from the server and sends a packet with given reason.


    Parameters

    • reason: string

    Returns void

getDisconnectCause

  • getDisconnectCause(): IOException
  • Returns IOException

getDisconnectPacket

  • getDisconnectPacket(): string
  • Returns string

getPlayerUid

  • getPlayerUid(): number

  • Returns number

    Unique numeric entity ID of the player.

send

  • send(name: string, packetData: object): void
  • Sends given packet to the following client.


    Parameters

    • name: string

      name of the packet to send

    • packetData: object

      packet data object

    Returns void

sendMessage

  • sendMessage(message: string): void
  • Sends a packet to the client with a text like a system message.


    Parameters

    • message: string

    Returns void