Package net.minestom.server.timer
Class SchedulerManager
java.lang.Object
net.minestom.server.timer.SchedulerManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
buildShutdownTask
(@NotNull Runnable runnable) void
process()
Process scheduled tasks based on time to increase scheduling precision.void
Advance 1 tick and callScheduler.process()
.void
Execute tasks set to run at the end of this tick.void
shutdown()
@NotNull Task
submitTask
(@NotNull Supplier<TaskSchedule> task, @NotNull ExecutionType executionType) Submits a new task with custom scheduling logic.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.timer.Scheduler
buildTask, execute, scheduleEndOfTick, scheduleNextProcess, scheduleNextProcess, scheduleNextTick, scheduleNextTick, scheduleTask, scheduleTask, scheduleTask, submitTask
-
Constructor Details
-
SchedulerManager
public SchedulerManager()
-
-
Method Details
-
process
public void process()Description copied from interface:Scheduler
Process scheduled tasks based on time to increase scheduling precision.This method is not thread-safe.
-
processTick
public void processTick()Description copied from interface:Scheduler
Advance 1 tick and callScheduler.process()
.This method is not thread-safe.
- Specified by:
processTick
in interfaceScheduler
-
processTickEnd
public void processTickEnd()Description copied from interface:Scheduler
Execute tasks set to run at the end of this tick.This method is not thread-safe.
- Specified by:
processTickEnd
in interfaceScheduler
-
submitTask
@NotNull public @NotNull Task submitTask(@NotNull @NotNull Supplier<TaskSchedule> task, @NotNull @NotNull ExecutionType executionType) Description copied from interface:Scheduler
Submits a new task with custom scheduling logic.This is the primitive method used by all scheduling shortcuts,
task
is immediately executed in the caller thread to retrieve its scheduling state and the task will stay alive as long asTaskSchedule.stop()
is not returned (orTask.cancel()
is called).- Specified by:
submitTask
in interfaceScheduler
- Parameters:
task
- the task to be directly executed in the caller threadexecutionType
- the execution type- Returns:
- the created task
-
shutdown
public void shutdown() -
buildShutdownTask
-