Class ScriptManager


  • public class ScriptManager
    extends java.lang.Object
    • Field Detail

      • args

        public java.lang.String[] args
    • Method Detail

      • getScriptManager

        public static ScriptManager getScriptManager()
      • startFromSchedule

        @Deprecated
        public AbstractScript startFromSchedule​(AbstractScript script,
                                                java.util.Map<java.lang.reflect.Field,​java.lang.Object> fields)
        Deprecated.
      • reloadLastScript

        public void reloadLastScript()
      • start

        public void start​(org.dreambot.internal.scripts.ScriptWrapper scriptWrapper)
      • start

        public void start​(java.lang.String scriptName,
                          java.lang.String... args)
      • start

        public void start​(java.lang.Class<? extends AbstractScript> scriptClass)
      • containsListener

        public boolean containsListener​(java.util.EventListener listener)
      • addListener

        public void addListener​(java.util.EventListener listener)
      • removeListener

        public void removeListener​(java.util.EventListener listener)
      • pause

        public void pause()
      • resume

        public void resume()
      • stopWithScheduledStop

        public void stopWithScheduledStop()
        This will attempt to stop the current script nicely by blocking up to 5 minutes until AbstractScript.onScheduledStop() returns true. This allows for the client to stop the script when a supported script says it's safe to stop.
      • stop

        public void stop()
        This will force stop the current script running, including killing the thread if necessary.

        This most likely shouldn't be used to stop your own script, see AbstractScript.stop() or stopWithScheduledStop() instead.

      • isPaused

        public boolean isPaused()
      • isRunning

        public boolean isRunning()
      • setAccount

        public boolean setAccount​(java.lang.String nickname)
      • getAccountNickname

        public java.lang.String getAccountNickname()
        Gets the currently selected account nickname from the Dreambot account manager
        Returns:
        account nickname if an account is selected, otherwise null
      • accountHasTotpKey

        public boolean accountHasTotpKey()
      • isAccountSet

        public boolean isAccountSet()
      • getLock

        public java.lang.Object getLock()
      • resetArgs

        public void resetArgs()
      • hasPremiumScript

        public boolean hasPremiumScript​(int productId)
        Checks if the current user has access to a premium script
        Parameters:
        productId - The product ID of the script in the store, you can find it by looking in the URL of the product before the name
        Returns:
        true if the user has an active trial or if they have an active purchase of the script
      • hasPurchasedScript

        public boolean hasPurchasedScript​(int productId)
        Checks if the current user has an active purchase of a premium script
        Parameters:
        productId - The product ID of the script in the store, you can find it by looking in the URL of the product before the name
        Returns:
        true only if the user has an active purchase of the script
      • getTotalInstances

        public int getTotalInstances​(int scriptId)
        Get the total number of instances purchased (or trialed) to a user for a script
        Parameters:
        scriptId - The script ID of the SDN which can be found on the Uploaded Scripts page in the SDN
        Returns:
        the total number of instances allowed for this user, -1 if they have no access or if the product isn't instanced
      • getActiveInstances

        public int getActiveInstances​(int scriptId)
        Get the active number of instances purchased (or trialed) to a user for a script currently in use
        Parameters:
        scriptId - The script ID of the SDN which can be found on the Uploaded Scripts page in the SDN
        Returns:
        the active number of running instances by this user, -1 if they have no access or if the product isn't instanced
      • hasSDNScript

        public boolean hasSDNScript​(int scriptId)
        Checks if the current user has access to an SDN script
        Parameters:
        scriptId - The script ID of the SDN, can be found on the Uploaded Scripts page in the SDN
        Returns:
        true if the user has access to that script, false otherwise
      • getAllScriptNames

        public java.util.List<java.lang.String> getAllScriptNames()
        Gets a list of all available script names
      • clearReloadedScript

        public void clearReloadedScript()
      • getArgs

        public java.lang.String[] getArgs()
      • getLastRanScript

        public org.dreambot.internal.scripts.ScriptWrapper getLastRanScript()
      • getAccount

        public org.dreambot.core.Account getAccount()
      • getIdleMouseThread

        public java.lang.Thread getIdleMouseThread()
      • getIdleCameraThread

        public java.lang.Thread getIdleCameraThread()