Class Connection

java.lang.Object
dev.twilite.game.facade.Connection

public class Connection extends Object
Utilities for manipulating the native client's login and network connection state.
  • Constructor Details

    • Connection

      public Connection()
  • Method Details

    • legacyLogin

      public static void legacyLogin(String username, String password, String otp)
      Starts a legacy username/password login.

      If otp is supplied, it is treated as a TOTP secret and converted into the current six-digit authenticator token before the login is started. Calling this also clears the active Jagex session and character identifiers so stale token-login state is not reused.

      Parameters:
      username - legacy account username
      password - legacy account password
      otp - optional TOTP secret, or null/blank when no authenticator is needed
    • jagexLogin

      public static void jagexLogin(String sessionId, String characterId, String displayName)
      Starts a Jagex-account token login for a specific character.

      This clears the legacy username/password fields, writes the Jagex session environment values used by the native client, and asks the client to begin game-token login.

      Parameters:
      sessionId - Jagex session identifier/token value
      characterId - target character identifier
      displayName - optional character display name
    • setProxy

      public static void setProxy(Connection.ProxyType type, String host, int port)
      Routes future native game socket connections through a proxy without authentication.
      Parameters:
      type - proxy protocol
      host - proxy host or IP address
      port - proxy port, from 1 to 65535
    • setProxy

      public static void setProxy(Connection.ProxyType type, String host, int port, String username, String password)
      Routes future native game socket connections through a proxy.

      Invalid values reset the proxy instead. Existing sockets are not reconnected; this only affects later native connect / WSAConnect calls.

      Parameters:
      type - proxy protocol
      host - proxy host or IP address
      port - proxy port, from 1 to 65535
      username - optional proxy username
      password - optional proxy password
    • resetProxy

      public static void resetProxy()
      Removes the active process-local proxy configuration.