Class Client


  • public class Client
    extends java.lang.Object
    Contains various fields and utility methods to perform various core client actions.
    • Constructor Summary

      Constructors 
      Constructor Description
      Client()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addChatMessage​(int type, java.lang.String name, java.lang.String message, java.lang.String sender)
      Adds a chat message to the RS Client.
      static void addChatMessage​(net.eternalclient.api.data.ChatMessageType type, java.lang.String name, java.lang.String message, java.lang.String sender)
      Adds a chat message to the client's chat box.
      static void clearProxy()
      Clears the proxy settings, setting "proxySet" to "false", "socksProxyHost" to an empty string, and "socksProxyPort" to an empty string.
      static boolean escToClose()
      Determines if the "ESC" key is used to close a player based on a specific bit value.
      static java.lang.String generateOtp​(java.lang.String otpKey)
      Generates a 6-digit OTP using the provided OTP key.
      static net.eternalclient.api.data.AccountType getAccountType()  
      static Proxy getActiveProxy()  
      static java.lang.String getBankPin()  
      static net.eternalclient.api.data.CharacterType getCharacterType()  
      static java.lang.String[] getClientArgs()  
      static RSClientPacket getClientPacket()
      Returns the client packet being sent to the server.
      static long getClientTick()
      Returns the current client tick value.
      static net.eternalclient.internal.IController getController()
      Retrieves the controller object from the rsClient.
      static float getCPUUsage()
      Returns the CPU usage as a percentage.
      static java.lang.String getDisplayName()  
      static <T> T getFromClientThread​(java.util.concurrent.Callable<T> callable)
      Executes the given callable task in the client thread and returns the result.
      static int getGameStateID()
      Returns the current game state ID.
      static long getGameTick()
      Returns the current game tick.
      static java.util.HashMap<java.util.function.Supplier<java.lang.Character>,​java.lang.Runnable> getKeyBindActions()  
      static long getLastClientTickTime()
      Returns the time of the last client tick.
      static long getLastGameTickTime()
      Retrieves the timestamp of the last game tick.
      static java.lang.String getLoggerDateTimeFormat()  
      static java.lang.String getLoginCharacterID()  
      static int getLoginIndex()
      Returns the login index of the current RSClient.
      static java.lang.String getLoginPassword()  
      static java.lang.String getLoginSessionID()  
      static java.lang.String getLoginUsername()  
      static MouseMotionFactory getMouseAlgorithm()  
      static java.lang.String getOtpKey()  
      static long getProcessorPid()
      Retrieves the process ID of the current processor.
      static int getRemainingMembershipDays()
      Returns the number of remaining membership days for a player.
      static RSClient getRSClient()
      This method returns the RSClient object.
      static java.awt.image.BufferedImage getScreenshot()
      Returns a screenshot of the current screen.
      static ISettings getSettings()
      Returns the settings object.
      static boolean hasMembership()
      Checks if the player has a membership status.
      static boolean inMembersWorld()
      Determines if the current world is a members' world.
      static void invokeOnClientThread​(java.lang.Runnable runnable)
      Invokes the specified runnable on the client thread.
      static void invokeOnClientThread​(java.util.function.BooleanSupplier booleanSupplier)
      Invokes the specified BooleanSupplier on the client thread.
      static boolean isAcceptAidActive()
      Checks if the Accept Aid option is currently active for the player.
      static boolean isCallbackDebugMode()  
      static boolean isDebugMode()  
      static boolean isEventDebugMode()  
      static boolean isInCutscene()
      Checks if the player is currently in a cutscene.
      static boolean isLoggedIn()
      Checks if the client is currently logged into a world.
      static boolean isMenuActionDebugMode()  
      static boolean isOnTutorialIsland()
      Checks if the player is currently on Tutorial Island.
      static void login​(java.lang.String username, java.lang.String password)
      Sets the username and password, disables login preference, and sets the game state to 20 on the client.
      static void loginOtp​(java.lang.String otp)
      Sets the OTP value, enables login preference, and sets the game state to 20 on the client.
      static void logout()
      Logs out the current user by clicking on the logout button.
      static void runScript​(java.lang.Object... args)
      Executes a script on the client thread.
      static void setBankPin​(java.lang.String bankPin)  
      static void setCallbackDebugMode​(boolean callbackDebugMode)  
      static void setClientArgs​(java.lang.String[] clientArgs)  
      static void setDebugMode​(boolean debugMode)  
      static void setDisplayName​(java.lang.String displayName)  
      static void setEventDebugMode​(boolean eventDebugMode)  
      static void setLoggerDateTimeFormat​(java.lang.String loggerDateTimeFormat)  
      static void setLoginCharacterID​(java.lang.String loginCharacterID)  
      static void setLoginPassword​(java.lang.String loginPassword)  
      static void setLoginSessionID​(java.lang.String loginSessionID)  
      static void setLoginUsername​(java.lang.String username)
      Sets the login username and updates the random seed based on the username.
      static void setMenuActionDebugMode​(boolean menuActionDebugMode)  
      static void setMouseAlgorithm​(MouseMotionFactory mouseAlgorithm)  
      static void setOtpKey​(java.lang.String otpKey)  
      static void setProxy​(java.lang.String ip, int port)
      Sets the proxy for the application.
      static void setProxy​(java.lang.String ip, int port, java.lang.String username, java.lang.String password)
      Sets the proxy configuration with the given IP, port, username, and password.
      static void setProxy​(Proxy proxy)
      Sets the proxy to be used for network connections.
      static boolean setTitle​(java.lang.String title)
      Sets the custom title bar text and updates the frame title, then checks if the frame title contains the specified title.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Client

        public Client()
    • Method Detail

      • getKeyBindActions

        public static java.util.HashMap<java.util.function.Supplier<java.lang.Character>,​java.lang.Runnable> getKeyBindActions()
      • isDebugMode

        public static boolean isDebugMode()
      • setDebugMode

        public static void setDebugMode​(boolean debugMode)
      • isEventDebugMode

        public static boolean isEventDebugMode()
      • setEventDebugMode

        public static void setEventDebugMode​(boolean eventDebugMode)
      • isCallbackDebugMode

        public static boolean isCallbackDebugMode()
      • setCallbackDebugMode

        public static void setCallbackDebugMode​(boolean callbackDebugMode)
      • isMenuActionDebugMode

        public static boolean isMenuActionDebugMode()
      • setMenuActionDebugMode

        public static void setMenuActionDebugMode​(boolean menuActionDebugMode)
      • setMouseAlgorithm

        public static void setMouseAlgorithm​(MouseMotionFactory mouseAlgorithm)
      • getAccountType

        public static net.eternalclient.api.data.AccountType getAccountType()
      • getCharacterType

        public static net.eternalclient.api.data.CharacterType getCharacterType()
      • getLoginUsername

        public static java.lang.String getLoginUsername()
      • setLoginUsername

        public static void setLoginUsername​(java.lang.String username)
        Sets the login username and updates the random seed based on the username.
        Parameters:
        username - the login username to set

        public static void setLoginUsername(String username) { // implementation details... }

      • getLoginPassword

        public static java.lang.String getLoginPassword()
      • setLoginPassword

        public static void setLoginPassword​(java.lang.String loginPassword)
      • getLoginSessionID

        public static java.lang.String getLoginSessionID()
      • setLoginSessionID

        public static void setLoginSessionID​(java.lang.String loginSessionID)
      • getLoginCharacterID

        public static java.lang.String getLoginCharacterID()
      • setLoginCharacterID

        public static void setLoginCharacterID​(java.lang.String loginCharacterID)
      • getBankPin

        public static java.lang.String getBankPin()
      • setBankPin

        public static void setBankPin​(java.lang.String bankPin)
      • getOtpKey

        public static java.lang.String getOtpKey()
      • setOtpKey

        public static void setOtpKey​(java.lang.String otpKey)
      • getDisplayName

        public static java.lang.String getDisplayName()
      • setDisplayName

        public static void setDisplayName​(java.lang.String displayName)
      • getClientArgs

        public static java.lang.String[] getClientArgs()
      • setClientArgs

        public static void setClientArgs​(java.lang.String[] clientArgs)
      • getLoggerDateTimeFormat

        public static java.lang.String getLoggerDateTimeFormat()
      • setLoggerDateTimeFormat

        public static void setLoggerDateTimeFormat​(java.lang.String loggerDateTimeFormat)
      • getRSClient

        public static RSClient getRSClient()
        This method returns the RSClient object.
        Returns:
        the RSClient object for performing operations.
      • getController

        public static net.eternalclient.internal.IController getController()
        Retrieves the controller object from the rsClient.
        Returns:
        the controller object.
      • getSettings

        public static ISettings getSettings()
        Returns the settings object.
        Returns:
        the settings object
      • getClientPacket

        public static RSClientPacket getClientPacket()
        Returns the client packet being sent to the server.
        Returns:
        a RSClientPacket object representing the client packet being sent
      • invokeOnClientThread

        public static void invokeOnClientThread​(java.lang.Runnable runnable)
        Invokes the specified runnable on the client thread.
        Parameters:
        runnable - the runnable to be invoked on the client thread
      • invokeOnClientThread

        public static void invokeOnClientThread​(java.util.function.BooleanSupplier booleanSupplier)
        Invokes the specified BooleanSupplier on the client thread.
        Parameters:
        booleanSupplier - the BooleanSupplier to be invoked on the client thread
      • getFromClientThread

        public static <T> T getFromClientThread​(java.util.concurrent.Callable<T> callable)
        Executes the given callable task in the client thread and returns the result.
        Type Parameters:
        T - the type to return
        Parameters:
        callable - the task to be executed in the client thread
        Returns:
        the result of the callable task execution
      • getClientTick

        public static long getClientTick()
        Returns the current client tick value.
        Returns:
        the current client tick
      • getLastClientTickTime

        public static long getLastClientTickTime()
        Returns the time of the last client tick.
        Returns:
        the time of the last client tick
      • getGameTick

        public static long getGameTick()
        Returns the current game tick.
        Returns:
        the current game tick as a long value.
      • getLastGameTickTime

        public static long getLastGameTickTime()
        Retrieves the timestamp of the last game tick.
        Returns:
        the timestamp of the last game tick as a long value
      • isLoggedIn

        public static boolean isLoggedIn()
        Checks if the client is currently logged into a world.
        Returns:
        true if the user is logged in, false otherwise

        public static boolean isLoggedIn()

      • getGameStateID

        public static int getGameStateID()
        Returns the current game state ID.
        Returns:
        the game state ID as an integer
      • getLoginIndex

        public static int getLoginIndex()
        Returns the login index of the current RSClient.
        Returns:
        the login index
      • getActiveProxy

        public static Proxy getActiveProxy()
      • setProxy

        public static void setProxy​(java.lang.String ip,
                                    int port)
        Sets the proxy for the application.
        Parameters:
        ip - the IP address of the proxy
        port - the port number of the proxy
      • setProxy

        public static void setProxy​(java.lang.String ip,
                                    int port,
                                    java.lang.String username,
                                    java.lang.String password)
        Sets the proxy configuration with the given IP, port, username, and password.
        Parameters:
        ip - the IP address of the proxy
        port - the port number of the proxy
        username - the username for authentication (optional)
        password - the password for authentication (optional)
      • setProxy

        public static void setProxy​(Proxy proxy)
        Sets the proxy to be used for network connections.
        Parameters:
        proxy - the proxy to be set, or null to disable proxy
      • clearProxy

        public static void clearProxy()
        Clears the proxy settings, setting "proxySet" to "false", "socksProxyHost" to an empty string, and "socksProxyPort" to an empty string.
      • getScreenshot

        public static java.awt.image.BufferedImage getScreenshot()
        Returns a screenshot of the current screen.
        Returns:
        the screenshot as a BufferedImage
      • setTitle

        public static boolean setTitle​(java.lang.String title)
        Sets the custom title bar text and updates the frame title, then checks if the frame title contains the specified title.
        Parameters:
        title - the title to set as the custom title bar text
        Returns:
        true if the frame title contains the specified title, false otherwise
      • isInCutscene

        public static boolean isInCutscene()
        Checks if the player is currently in a cutscene.
        Returns:
        true if the player is in a cutscene, false otherwise.
      • hasMembership

        public static boolean hasMembership()
        Checks if the player has a membership status.
        Returns:
        true if the player has membership, false otherwise.
      • getRemainingMembershipDays

        public static int getRemainingMembershipDays()
        Returns the number of remaining membership days for a player.
        Returns:
        the number of remaining membership days as an integer.
      • isAcceptAidActive

        public static boolean isAcceptAidActive()
        Checks if the Accept Aid option is currently active for the player.
        Returns:
        true if Accept Aid is active, false otherwise.
      • getCPUUsage

        public static float getCPUUsage()
        Returns the CPU usage as a percentage.
        Returns:
        the CPU usage as a float value between 0 and 99.
      • getProcessorPid

        public static long getProcessorPid()
        Retrieves the process ID of the current processor.
        Returns:
        the process ID of the current processor as a long value.
      • inMembersWorld

        public static boolean inMembersWorld()
        Determines if the current world is a members' world.
        Returns:
        true if the current world is a members' world, false otherwise.
      • addChatMessage

        public static void addChatMessage​(int type,
                                          java.lang.String name,
                                          java.lang.String message,
                                          java.lang.String sender)
        Adds a chat message to the RS Client.
        Parameters:
        type - the type of the chat message
        name - the name associated with the chat message
        message - the content of the chat message
        sender - the sender of the chat message
      • addChatMessage

        public static void addChatMessage​(net.eternalclient.api.data.ChatMessageType type,
                                          java.lang.String name,
                                          java.lang.String message,
                                          java.lang.String sender)
        Adds a chat message to the client's chat box.
        Parameters:
        type - the type of the chat message
        name - the name associated with the chat message
        message - the content of the chat message
        sender - the sender of the chat message
      • login

        public static void login​(java.lang.String username,
                                 java.lang.String password)
        Sets the username and password, disables login preference, and sets the game state to 20 on the client.
        Parameters:
        username - the username to login with.
        password - the password to login with.
      • loginOtp

        public static void loginOtp​(java.lang.String otp)
        Sets the OTP value, enables login preference, and sets the game state to 20 on the client.
        Parameters:
        otp - the one-time password to set
      • generateOtp

        public static java.lang.String generateOtp​(java.lang.String otpKey)
        Generates a 6-digit OTP using the provided OTP key.
        Parameters:
        otpKey - the OTP key to generate the OTP
        Returns:
        a 6-digit OTP string
      • runScript

        public static void runScript​(java.lang.Object... args)
        Executes a script on the client thread.
        Parameters:
        args - the arguments for the script.
      • escToClose

        public static boolean escToClose()
        Determines if the "ESC" key is used to close a player based on a specific bit value.
        Returns:
        true if the bit value is 1, false otherwise.
      • isOnTutorialIsland

        public static boolean isOnTutorialIsland()
        Checks if the player is currently on Tutorial Island.
        Returns:
        true if the player is on Tutorial Island, false otherwise.
      • logout

        public static void logout()
        Logs out the current user by clicking on the logout button.