Package org.dreambot.api.randoms
Class RandomManager
- java.lang.Object
-
- org.dreambot.api.randoms.RandomManager
-
- All Implemented Interfaces:
java.lang.Runnable
public class RandomManager extends java.lang.Object implements java.lang.Runnable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RandomManager.State
-
Constructor Summary
Constructors Constructor Description RandomManager(java.lang.Thread scriptThread, AbstractScript script)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearRegisteredSolvers()
void
disableSolver(java.lang.String event)
void
disableSolver(RandomEvent event)
void
enableSolver(java.lang.String event)
void
enableSolver(RandomEvent event)
BreakSolver
getBreakSolver()
RandomSolver
getCurrentSolver()
java.lang.Thread
getRandomThread()
RandomSolver
getSolver(java.lang.String eventName)
Gets a random solver where the random solver'sRandomSolver.getEventString()
matches the given eventName.WelcomeScreenSolver
getWelcomeScreenSolver()
boolean
isSolving()
boolean
isUsingCustomBreakSolver()
void
kill()
int
onLoop()
Does the login for checking and running a random solvervoid
registerSolver(RandomSolver solver)
Registers a random solver with priority higher than default.void
run()
void
runRandomManager()
void
setRandomThread(java.lang.Thread randomThread)
void
unregisterSolver(java.lang.String event)
Removes a random solvers with a given event string.void
unregisterSolver(RandomEvent event)
Removes a random solver.
-
-
-
Constructor Detail
-
RandomManager
public RandomManager(java.lang.Thread scriptThread, AbstractScript script)
-
-
Method Detail
-
getSolver
public RandomSolver getSolver(java.lang.String eventName)
Gets a random solver where the random solver'sRandomSolver.getEventString()
matches the given eventName. Note: When building a random solver with aRandomEvent
it uses theRandomEvent.toString()
to generate event string.This method is not case-sensitive.
- Parameters:
eventName
- String of the random solver's event- Returns:
- Random solver matching given event or null if not found.
-
clearRegisteredSolvers
public void clearRegisteredSolvers()
-
registerSolver
public void registerSolver(RandomSolver solver)
Registers a random solver with priority higher than default. If two or more random solvers are registered, the one registered last will have priority- Parameters:
solver
- Random solver to register
-
unregisterSolver
public void unregisterSolver(RandomEvent event)
Removes a random solver. If there are more than one, the one with highest priority is removed (script registered ones, then default)Built in solvers cannot be unregistered, any attempt to do so will result in the solver being disabled.
- Parameters:
event
- Event of random solver to be removed
-
unregisterSolver
public void unregisterSolver(java.lang.String event)
Removes a random solvers with a given event string. If based on aRandomEvent
it uses theRandomEvent.toString()
Built in solvers cannot be unregistered, any attempt to do so will result in the solver being disabled. This matches againstRandomSolver.getEventString()
- Parameters:
event
- Event string of random solver to be removed.
-
onLoop
public int onLoop()
Does the login for checking and running a random solver- Returns:
- -1 if no random solvers running, otherwise delay time
-
isSolving
public boolean isSolving()
-
getBreakSolver
public BreakSolver getBreakSolver()
-
isUsingCustomBreakSolver
public boolean isUsingCustomBreakSolver()
-
disableSolver
public void disableSolver(java.lang.String event)
-
disableSolver
public void disableSolver(RandomEvent event)
-
enableSolver
public void enableSolver(java.lang.String event)
-
enableSolver
public void enableSolver(RandomEvent event)
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
runRandomManager
public void runRandomManager()
-
kill
public void kill()
-
getWelcomeScreenSolver
public WelcomeScreenSolver getWelcomeScreenSolver()
-
getCurrentSolver
public RandomSolver getCurrentSolver()
-
getRandomThread
public java.lang.Thread getRandomThread()
-
setRandomThread
public void setRandomThread(java.lang.Thread randomThread)
-
-