StepHandler
Manages transport stateful step execution.
Final classRLPlugins API
public final class StepHandlerMembers
Constructors
- newStepHandler(Map<Integer, Function<StepContext, Integer>>)
Creates a StepHandler.
Methods
- voidadd(int, Function<StepContext, Integer>)
Adds a step to the transport handler.
- voidexecute()
Execute.
- StepContextgetContext()
The context.
- booleanisStarted()
Whether started.
- voidreset()
Resets the step handler.
- intsize()
Gets the number of steps in this transport handler.
- booleanstep()
Executes the current step and advances the step pointer.
StepHandler(Map<Integer, Function<StepContext, Integer>>)
public StepHandler(Map<Integer, Function<StepContext, Integer>> steps)Creates a StepHandler.
Parameters
steps- Steps.
add(int, Function<StepContext, Integer>)
public void add(int step, Function<StepContext, Integer> function)Adds a step to the transport handler.
Parameters
step- The step index.
function- The action to perform at this step, returning the next step index.
execute()
public void execute()Execute.
- Can wait for the game. Call it only from
VitaPlugin.loop(); in a@Subscribemethod it freezes the game.
getContext()
public StepContext getContext()The context.
isStarted()
public boolean isStarted()Whether started.
reset()
public void reset()Resets the step handler.
size()
public int size()Gets the number of steps in this transport handler.
Returns
The number of steps.
step()
public boolean step()Executes the current step and advances the step pointer.
Returns
True if there are more steps to execute, false if the transport is complete.
Also allowed
Every class has these, as in plain Java.
equals, toString