Class MycelScheduler
java.lang.Object
my.celium.org.schedule.MycelScheduler
Safe scheduling helpers.
runLater(long, Runnable)/runEvery(long, Runnable)execute on the server thread and may touch worlds, entities and players.runAsync(Runnable)executes on a shared background pool for IO such as HTTP. It must never touch game state; hop back withrunOnServer(Runnable)when done.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanIs the current thread the server thread? Useful for assertions in mod code.static voidRunstaskon Mycel's shared background pool.static ScheduledTaskRunstaskon the server thread everyintervalTicksticks.static voidRunstaskon the server thread afterdelayTicksserver ticks.static voidrunOnServer(Runnable task) Queuestaskonto the server thread.
-
Method Details
-
runLater
Runstaskon the server thread afterdelayTicksserver ticks. When no server is running yet, the task waits for the next server tick. -
runEvery
Runstaskon the server thread everyintervalTicksticks. The returned handle cancels future runs (also cancelled automatically on server stop). -
runAsync
Runstaskon Mycel's shared background pool. Never touch game state here. -
runOnServer
Queuestaskonto the server thread. Safe to call from background threads; if no server is running the task is dropped with a warning. -
isServerThread
public static boolean isServerThread()Is the current thread the server thread? Useful for assertions in mod code.
-