task

fun task(sync: Boolean = true, delay: Long = 0, period: Long? = null, howOften: Long? = null, safe: Boolean = false, endCallback: () -> Unit? = null, runnable: (KSpigotRunnable) -> Unit? = null): KSpigotRunnable?

Starts a new BukkitRunnable.

Return

the KSpigotRunnable

Parameters

sync

if the runnable should run sync (true) or async (false)

howOften

how many times the task should be executed - null for infinite execution

delay

the delay (in ticks) until the first execution of the task

period

at which interval (in ticks) the task should be repeated

safe

if the endCallback of the runnable should always be executed, even if the server shuts down or the runnable ends prematurely

endCallback

code that should always be executed when the runnable ends

runnable

the runnable which should be executed each repetition