Update KSpigotRunnables.kt

This commit is contained in:
bluefireoly
2021-01-10 22:07:15 +01:00
parent 277fa29ec2
commit e65b3c724c

View File

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