Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ClientManagerEvent

ClientManagerEvent is a simple data class used to pass information from an application's ClientManager to registered event-listeners when a client-management event occurs. The ClientManagerEvent class also defines constants representing the available client-management events.

Hierarchy

  • Event
    • ClientManagerEvent

Index

Constructors

constructor

  • new ClientManagerEvent(type: string, clientID?: undefined | string, client?: Client, address?: undefined | string, status?: Status): ClientManagerEvent
  • Parameters

    • type: string
    • Optional clientID: undefined | string
    • Optional client: Client
    • Optional address: undefined | string
    • Optional status: Status

    Returns ClientManagerEvent

Properties

Optional target

target: EventDispatcher

type

type: string

Static Readonly ADDRESS_BANNED

ADDRESS_BANNED: "ADDRESS_BANNED" = "ADDRESS_BANNED"

Dispatched when the ClientManager is informed by Union Server that a client address was banned. This event is available when the ClientManager is watching for banned addresses only (see watchForBannedAddresses()).

Static Readonly ADDRESS_UNBANNED

ADDRESS_UNBANNED: "ADDRESS_UNBANNED" = "ADDRESS_UNBANNED"

Dispatched when the ClientManager is informed by Union Server that a client address was unbanned. This event is available when the ClientManager is watching for banned addresses only (see watchForBannedAddresses()).

Static Readonly BAN_RESULT

BAN_RESULT: "BAN_RESULT" = "BAN_RESULT"

Dispatched when the result of an earlier Client.ban or ClientManager.ban request is received.

Static Readonly CLIENT_CONNECTED

CLIENT_CONNECTED: "CLIENT_CONNECTED" = "CLIENT_CONNECTED"

Dispatched when the ClientManager is informed by Union Server that a client connected. This event is available when the ClientManager is watching for clients only (see watchForClients()).

Static Readonly CLIENT_DISCONNECTED

CLIENT_DISCONNECTED: "CLIENT_DISCONNECTED" = "CLIENT_DISCONNECTED"

Dispatched when the ClientManager is informed by Union Server that a client disconnected. This event is available when the ClientManager is watching for clients (see watchForClients()) or observing the client that disconnected (see observeClient()) only.

Static Readonly KICK_RESULT

KICK_RESULT: "KICK_RESULT" = "KICK_RESULT"

Dispatched when the result of an earlier Client.kick or ClientManager.kickClient request is received.

Static Readonly STOP_WATCHING_FOR_BANNED_ADDRESSES_RESULT

STOP_WATCHING_FOR_BANNED_ADDRESSES_RESULT: "STOP_WATCHING_FOR_BANNED_ADDRESSES_RESULT" = "STOP_WATCHING_FOR_BANNED_ADDRESSES_RESULT"

Dispatched when the result of an earlier call to ClientManager.stopWatchingForBannedAddresses is received.

Static Readonly STOP_WATCHING_FOR_CLIENTS_RESULT

STOP_WATCHING_FOR_CLIENTS_RESULT: "STOP_WATCHING_FOR_CLIENTS_RESULT" = "STOP_WATCHING_FOR_CLIENTS_RESULT"

Dispatched when the ClientManager receives the result of an earlier stopWatchingForClients() request.

To determine the result of the attempt, use getStatus(), which has the following possible return values:

  • Status.SUCCESS
  • Status.ERROR
  • Status.NOT_WATCHING

Static Readonly SYNCHRONIZE

SYNCHRONIZE: "SYNCHRONIZE" = "SYNCHRONIZE"

Dispatched when the ClientManager's list of clients has finished being synchronized after a watchForClients() request.

Static Readonly SYNCHRONIZE_BANLIST

SYNCHRONIZE_BANLIST: "SYNCHRONIZE_BANLIST" = "SYNCHRONIZE_BANLIST"

Dispatched when the ClientManager's list of clients has finished being synchronized after a watchForBannedAddresses() request.

Static Readonly UNBAN_RESULT

UNBAN_RESULT: "UNBAN_RESULT" = "UNBAN_RESULT"

Dispatched when the result of an earlier ClientManager.unban() request is received.

Static Readonly WATCH_FOR_BANNED_ADDRESSES_RESULT

WATCH_FOR_BANNED_ADDRESSES_RESULT: "WATCH_FOR_BANNED_ADDRESSES_RESULT" = "WATCH_FOR_BANNED_ADDRESSES_RESULT"

Dispatched when the result of an earlier call to ClientManager.watchForBannedAddresses is received.

Static Readonly WATCH_FOR_CLIENTS_RESULT

WATCH_FOR_CLIENTS_RESULT: "WATCH_FOR_CLIENTS_RESULT" = "WATCH_FOR_CLIENTS_RESULT"

Dispatched when the ClientManager receives the result of an earlier watchForClients() request.

To determine the result of the request, use getStatus(), which has the following possible return values:

  • Status.SUCCESS
  • Status.ERROR
  • Status.ALREADY_WATCHING

Methods

getAddress

  • getAddress(): string | null
  • Returns an address that was either banned or unbanned. This method applies to the following events:

    • ClientManagerEvent.BAN_RESULT
    • ClientManagerEvent.UNBAN_RESULT
    • ClientManagerEvent.ADDRESS_BANNED
    • ClientManagerEvent.ADDRESS_UNBANNED

    Returns string | null

getClient

  • Returns the Client object for the client to which this event pertains. For example, for the ClientManagerEvent.CLIENT_DISCONNECTED event, getClient() returns the Client object for the client that disconnected.

    Returns Client | null

getClientID

  • getClientID(): string | null
  • Returns the clientID of the client to which this event pertains. For example, for the ClientManagerEvent.CLIENT_CONNECTED event, getClientID() returns the clientID of the client that connected.

    Returns string | null

getStatus

  • Returns the status of the client-management operation to which this event pertains.

    The getStatus() method's return value is always one of the Status class's constants. For example, getStatus() might return the value of Status.SUCCESS.

    For a list of specific status values that are available for a particular ClientManagerEvent event, see that event's documentation.

    Returns Status | null