Update KSpigotRunnables.kt
This commit is contained in:
@@ -46,6 +46,8 @@ abstract class KSpigotRunnable(
|
|||||||
* even if the server shuts down or the runnable ends prematurely
|
* even if the server shuts down or the runnable ends prematurely
|
||||||
* @param endCallback code that should always be executed when the runnable ends
|
* @param endCallback code that should always be executed when the runnable ends
|
||||||
* @param runnable the runnable which should be executed each repetition
|
* @param runnable the runnable which should be executed each repetition
|
||||||
|
*
|
||||||
|
* @return the [KSpigotRunnable]
|
||||||
*/
|
*/
|
||||||
fun task(
|
fun task(
|
||||||
sync: Boolean = true,
|
sync: Boolean = true,
|
||||||
@@ -55,9 +57,9 @@ fun task(
|
|||||||
safe: Boolean = false,
|
safe: Boolean = false,
|
||||||
endCallback: (() -> Unit)? = null,
|
endCallback: (() -> Unit)? = null,
|
||||||
runnable: ((KSpigotRunnable) -> Unit)? = null
|
runnable: ((KSpigotRunnable) -> Unit)? = null
|
||||||
) {
|
): KSpigotRunnable? {
|
||||||
|
|
||||||
if (howOften != null && howOften == 0L) return
|
if (howOften != null && howOften == 0L) return null
|
||||||
|
|
||||||
val bukkitRunnable = object : KSpigotRunnable() {
|
val bukkitRunnable = object : KSpigotRunnable() {
|
||||||
|
|
||||||
@@ -103,6 +105,8 @@ fun task(
|
|||||||
if (sync) bukkitRunnable.runTaskLater(KSpigotMainInstance, delay)
|
if (sync) bukkitRunnable.runTaskLater(KSpigotMainInstance, delay)
|
||||||
else bukkitRunnable.runTaskLaterAsynchronously(KSpigotMainInstance, delay)
|
else bukkitRunnable.runTaskLaterAsynchronously(KSpigotMainInstance, delay)
|
||||||
|
|
||||||
|
return bukkitRunnable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user