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
Nested Classes -
Field Summary
Fields inherited from class de.eldoria.eldoutilities.scheduling.QueuingSelfSchedulingTask
DEFAULT_MAX_DURATION_TARGET, DEFAULT_MAX_IDLE_TICKS -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(DelayedActions.DelayedTask object) handle one object which was polled from the queueprotected Queue<DelayedActions.DelayedTask>protected booleanproceed(DelayedActions.DelayedTask object) Define if this object should be polled from queue or if the scheduler should proceed to the next tick.voidDelays an action by a specific amount of ticksstatic DelayedActionsstart(org.bukkit.plugin.Plugin plugin) Start a delayed action scheduler for a plugin.voidtick()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:QueuingSelfSchedulingTaskhandle one object which was polled from the queue- Specified by:
executein classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>- Parameters:
object- object from queue
-
tick
public void tick()Description copied from class:QueuingSelfSchedulingTaskTick is executed once per tick.- Overrides:
tickin classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>
-
getQueueImplementation
- Overrides:
getQueueImplementationin 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:QueuingSelfSchedulingTaskDefine if this object should be polled from queue or if the scheduler should proceed to the next tick.- Overrides:
proceedin classQueuingSelfSchedulingTask<DelayedActions.DelayedTask>- Parameters:
object- object to check- Returns:
- true if the object should be handeld. false if the task should wait.
-