Scheduler
Running code later, or again and again.
Times are in ticks (60 a second) or seconds. Every task runs on the server's tick, after the world's step.
You get one from server.scheduler().
Methods
| Method | Description |
|---|---|
fn next_tick(&self, run: impl FnMut() + 'static) -> Result<Task>Task nextTick(Runnable run) | Runs once, on the next tick. |
fn after(&self, ticks: i64, run: impl FnMut() + 'static) -> Result<Task>Task after(long ticks, Runnable run) | Runs once after a number of ticks. |
fn after_seconds(&self, seconds: f64, run: impl FnMut() + 'static) -> Result<Task>Task afterSeconds(double seconds, Runnable run) | Runs once after some seconds. |
fn every(&self, ticks: i64, run: impl FnMut() + 'static) -> Result<Task>Task every(long ticks, Runnable run) | Runs again and again, a number of ticks apart. |
fn every_seconds(&self, seconds: f64, run: impl FnMut() + 'static) -> Result<Task>Task everySeconds(double seconds, Runnable run) | Runs again and again, some seconds apart. |
fn cancel_all(&self) -> Result<()>void cancelAll() | Cancels every task this plugin made. |
Task
A scheduled task.
A handle to something in the game. Once that thing is gone, its calls fail with Gone.
| Method | Description |
|---|---|
fn running(&self) -> Result<bool>boolean running() | Whether it is still to run. |
fn cancel(&self) -> Result<()>void cancel() | Stops it running. |