Class DelayedActions
java.lang.Object
de.eldoria.eldoutilities.threading.ReschedulingTask
de.eldoria.eldoutilities.scheduling.QueuingSelfSchedulingTask<DelayedActions.DelayedTask>
de.eldoria.eldoutilities.scheduling.DelayedActions
Scheduler service to schedule actions with only one scheduler and preserving the main thread from overloading.
- Since:
- 1.2.3
-
Nested Class Summary
-
Field Summary
Fields inherited from class de.eldoria.eldoutilities.scheduling.QueuingSelfSchedulingTask
DEFAULT_MAX_DURATION_TARGET, DEFAULT_MAX_IDLE_TICKS
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(DelayedActions.DelayedTask object) handle one object which was polled from the queueprotected Queue<DelayedActions.DelayedTask>
protected boolean
proceed
(DelayedActions.DelayedTask object) Define if this object should be polled from queue or if the scheduler should proceed to the next tick.void
Delays an action by a specific amount of ticksstatic DelayedActions
Start a delayed action scheduler for a plugin.void
tick()
Tick is executed once per tick.Methods inherited from class de.eldoria.eldoutilities.scheduling.QueuingSelfSchedulingTask
clear, remove, removeIf, run, schedule, shutdown
-
Method Details
-
start
Start a delayed action scheduler for a plugin.This scheduler allows to schedule multiple task without starting a new scheduler for each task.
The scheduler will also ensure that the main thread is not abused by overloading operations per tick.
- Parameters:
plugin
- plugin which owns the instance- Returns:
- new delayed action instance
-
execute
Description copied from class:QueuingSelfSchedulingTask
handle one object which was polled from the queue- Specified by:
execute
in classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>
- Parameters:
object
- object from queue
-
tick
public void tick()Description copied from class:QueuingSelfSchedulingTask
Tick is executed once per tick.- Overrides:
tick
in classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>
-
getQueueImplementation
- Overrides:
getQueueImplementation
in classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>
-
schedule
Delays an action by a specific amount of ticks- Parameters:
runnable
- runnable to executedelay
- delay for execution.
-
proceed
Description copied from class:QueuingSelfSchedulingTask
Define if this object should be polled from queue or if the scheduler should proceed to the next tick.- Overrides:
proceed
in classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>
- Parameters:
object
- object to check- Returns:
- true if the object should be handeld. false if the task should wait.
-