Skip to content
7ixi0 edited this page Apr 27, 2018 · 2 revisions

Proxy(serverSettings, serverList, proxyOptions)

The Proxy class. This class extends the Server class from node-minecraft-protocol. More information about the Server class can be found here.

Constructor arguments

  • serverSettings

    An object with the arguments for the Server class. The options for this class are explained in the node-minecraft-protocol documentation.

  • serverList

    A serverList object. See createProxy() for more info.

  • proxyOptions

    • autoConnect: bool If the proxy should automatically forward player to the default server when they connect
    • autoFallback: bool If the proxy should move players to the fallback server when they get kicked from another server

Variables

  • ServerList

    The server list object that was passed when creating the proxy. This object can be modified.

  • AutoConnect

    Whether the proxy automatically forwards players to the default server when they connect. Can be modified.

  • AutoFallback

    Whether the proxy automatically moves players to the fallback server when they lose connection. Can be modified.

  • All the variables inherited from the node-minecraft-protocol Server class

Methods

  • setRemoteServer(remoteClientId, newServerName)

    Move the client with the specified ClientId to the server with the specified newServerName

    Arguments

    • remoteClientId

      The id of the client. The client object is inherited from the Server class.

    • newServerName

      The name of the new server to which the client will be connected. This name should be present in the serverList.

  • fallback(remoteClientId)

    Move the client with the specified ClientId to the fallback server (obtained using getFallBackServer())

    Arguments

    • remoteClientId

      The id of the client. The client object is inherited from the Server class.

  • getFallbackServerName()

    Returns the serverName of the fallback server.

  • getDefaultServerName()

    Returns the serverName of the default server.

  • All the methods inherited from the node-minecraft-protocol Server class

Events

  • Error

    Emitted when an error occurs.

    Parameters

    • error: the error object
  • Login

    Inherited from the Server class from node-minecraft-protocol, emitted when a player logs in. If autoConnect is set to false, the player should be manually connected here by calling setRemoteServer().

  • playerMoving

    Emitted when a player is moving from a server to another (whether the player is being moved normally or is falling back to another server).

    Parameters

    • playerId: the id of the client that is being moved.
    • oldServerName: the id of the server from which the player is being moved.
    • newServerName: the id of the server to which the player is being moved.
  • playerMoved

    Emitted when a player has been moved from a server to another (whether the player was moved normally or was falling back to another server).

    Parameters

    • playerId: the id of the client that was moved.
    • oldServerName: the id of the server from which the player was moved.
    • newServerName: the id of the server to which the player was moved.
  • moveFailed

    Emitted when a player has failed to move from a server to another (whether the player was moved normally or was falling back to another server, normally emitted together with the error event).

    Parameters

    • error: the error that prevented the move of the player.
    • playerId: the id of the client that was being moved.
    • oldServerName: the id of the server from which the player was being moved.
    • newServerName: the id of the server to which the player was being moved.
  • playerFallback

    Emitted when a player is falling back from a server to another (normally emitted together with the playerMoving event).

    Parameters

    • playerId: the id of the client that is being moved.
    • oldServerName: the id of the server from which the player is being moved.
    • newServerName: the id of the server to which the player is being moved.
  • All the events inherited from the node-minecraft-protocol Server class