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 class
ScriptManager.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 boolean
accountHasTotpKey()
void
addListener(java.util.EventListener listener)
void
clearReloadedScript()
boolean
containsListener(java.util.EventListener listener)
org.dreambot.core.Account
getAccount()
java.lang.String
getAccountNickname()
Gets the currently selected account nickname from the Dreambot account managerint
getActiveInstances(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()
AbstractScript
getCurrentScript()
java.lang.Thread
getIdleCameraThread()
java.lang.Thread
getIdleMouseThread()
org.dreambot.internal.scripts.ScriptWrapper
getLastRanScript()
java.lang.Object
getLock()
static ScriptManager
getScriptManager()
ScriptManager.State
getState()
int
getTotalInstances(int scriptId)
Get the total number of instances purchased (or trialed) to a user for a scriptboolean
hasPremiumScript(int productId)
Checks if the current user has access to a premium scriptboolean
hasPurchasedScript(int productId)
Checks if the current user has an active purchase of a premium scriptboolean
hasSDNScript(int scriptId)
Checks if the current user has access to an SDN scriptboolean
isAccountSet()
boolean
isPaused()
boolean
isRunning()
void
pause()
void
reloadLastScript()
void
removeListener(java.util.EventListener listener)
void
resetArgs()
void
resume()
boolean
setAccount(java.lang.String nickname)
void
start(java.lang.Class<? extends AbstractScript> scriptClass)
void
start(java.lang.String scriptName, java.lang.String... args)
void
start(org.dreambot.internal.scripts.ScriptWrapper scriptWrapper)
AbstractScript
startFromSchedule(AbstractScript script, java.util.Map<java.lang.reflect.Field,java.lang.Object> fields)
Deprecated.void
stop()
This will force stop the current script running, including killing the thread if necessary.void
stopWithScheduledStop()
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
-
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()
-
getCurrentScript
public AbstractScript getCurrentScript()
-
getAccount
public org.dreambot.core.Account getAccount()
-
getIdleMouseThread
public java.lang.Thread getIdleMouseThread()
-
getIdleCameraThread
public java.lang.Thread getIdleCameraThread()
-
-