Package org.dreambot.api.script
Class ScriptManager
- java.lang.Object
-
- org.dreambot.api.script.ScriptManager
-
public class ScriptManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScriptManager.State
-
Field Summary
Fields Modifier and Type Field Description java.lang.String[]args
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaccountHasTotpKey()voidaddListener(java.util.EventListener listener)voidclearReloadedScript()booleancontainsListener(java.util.EventListener listener)org.dreambot.core.AccountgetAccount()java.lang.StringgetAccountNickname()Gets the currently selected account nickname from the Dreambot account managerintgetActiveInstances(int scriptId)Get the active number of instances purchased (or trialed) to a user for a script currently in usejava.util.List<java.lang.String>getAllScriptNames()Gets a list of all available script namesjava.lang.String[]getArgs()AbstractScriptgetCurrentScript()java.lang.ThreadgetIdleCameraThread()java.lang.ThreadgetIdleMouseThread()org.dreambot.internal.scripts.ScriptWrappergetLastRanScript()java.lang.ObjectgetLock()static ScriptManagergetScriptManager()ScriptManager.StategetState()intgetTotalInstances(int scriptId)Get the total number of instances purchased (or trialed) to a user for a scriptbooleanhasPremiumScript(int productId)Checks if the current user has access to a premium scriptint[]hasPremiumScripts(int... productIds)Checks if the current user has access to given premium scriptsbooleanhasPurchasedScript(int productId)Checks if the current user has an active purchase of a premium scriptint[]hasPurchasedScripts(int... productIds)Checks if the current user has an active purchase of the given premium scriptsbooleanhasSDNScript(int scriptId)Checks if the current user has access to an SDN scriptint[]hasSDNScripts(int... scriptIds)Checks if the current user has access to given SDN scriptsbooleanisAccountSet()booleanisPaused()booleanisRunning()voidpause()voidreloadLastScript()voidremoveListener(java.util.EventListener listener)voidresetArgs()voidresume()booleansetAccount(java.lang.String nickname)voidstart(java.lang.Class<? extends AbstractScript> scriptClass)voidstart(java.lang.String scriptName, java.lang.String... args)voidstart(org.dreambot.internal.scripts.ScriptWrapper scriptWrapper)AbstractScriptstartFromSchedule(AbstractScript script, java.util.Map<java.lang.reflect.Field,java.lang.Object> fields)Deprecated.voidstop()This will force stop the current script running, including killing the thread if necessary.voidstopWithScheduledStop()This will attempt to stop the current script nicely by blocking up to 5 minutes untilAbstractScript.onScheduledStop()returns true.
-
-
-
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 untilAbstractScript.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()orstopWithScheduledStop()instead.
-
isPaused
public boolean isPaused()
-
isRunning
public boolean isRunning()
-
getState
public ScriptManager.State getState()
-
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
-
hasPremiumScripts
public int[] hasPremiumScripts(int... productIds)
Checks if the current user has access to given premium scripts- Parameters:
productIds- Array of the product IDs of the scripts in the store, you can find it by looking in the URL of the product before the name- Returns:
- array of product ids that are owned by the user
-
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
-
hasPurchasedScripts
public int[] hasPurchasedScripts(int... productIds)
Checks if the current user has an active purchase of the given premium scripts- Parameters:
productIds- The product IDs of the scripts in the store, you can find it by looking in the URL of the product before the name- Returns:
- array of the product ids owned by the user
-
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
-
hasSDNScripts
public int[] hasSDNScripts(int... scriptIds)
Checks if the current user has access to given SDN scripts- Parameters:
scriptIds- Script ID of the SDN, can be found on the uploaded scripts page in the SDN- Returns:
- array of script IDs that the user has access to
-
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()
-
getCurrentScript
public AbstractScript getCurrentScript()
-
getAccount
public org.dreambot.core.Account getAccount()
-
getIdleMouseThread
public java.lang.Thread getIdleMouseThread()
-
getIdleCameraThread
public java.lang.Thread getIdleCameraThread()
-
-