Changed "bukkit" in the name of runnable methods to "task"

This commit is contained in:
bluefireoly
2020-10-23 00:09:58 +02:00
parent 53994d3c4b
commit 8ba0a7bd4a
2 changed files with 6 additions and 6 deletions

View File

@@ -43,7 +43,7 @@ abstract class ChainedRunnablePart<T, R>(
) )
protected fun start(data: T) { protected fun start(data: T) {
bukkitRun(sync) { taskRun(sync) {
val result = invoke(data) val result = invoke(data)
next?.start(result) next?.start(result)
} }
@@ -55,7 +55,7 @@ abstract class ChainedRunnablePart<T, R>(
exceptionSync: Boolean, exceptionSync: Boolean,
exceptionHandler: ((E) -> Unit)?, exceptionHandler: ((E) -> Unit)?,
) { ) {
bukkitRun(sync) { taskRun(sync) {
val result = try { val result = try {
invoke(data) invoke(data)
} catch (e: Exception) { } catch (e: Exception) {
@@ -64,11 +64,11 @@ abstract class ChainedRunnablePart<T, R>(
if (sync == exceptionSync) { if (sync == exceptionSync) {
exceptionHandler?.invoke(e as E) exceptionHandler?.invoke(e as E)
} else if (exceptionHandler != null) { } else if (exceptionHandler != null) {
bukkitRun(exceptionSync) { taskRun(exceptionSync) {
exceptionHandler.invoke(e as E) exceptionHandler.invoke(e as E)
} }
} }
return@bukkitRun return@taskRun
} else throw e } else throw e
} }
next?.startCatching(result, exceptionClass, exceptionSync, exceptionHandler) next?.startCatching(result, exceptionClass, exceptionSync, exceptionHandler)

View File

@@ -109,7 +109,7 @@ fun task(
* Executes the given [runnable] with the given [delay]. * Executes the given [runnable] with the given [delay].
* Either sync or async (specified by the [sync] parameter). * Either sync or async (specified by the [sync] parameter).
*/ */
fun bukkitRunLater(delay: Long, sync: Boolean = true, runnable: () -> Unit) { fun taskRunLater(delay: Long, sync: Boolean = true, runnable: () -> Unit) {
if (sync) if (sync)
Bukkit.getScheduler().runTaskLater(KSpigotMainInstance, runnable, delay) Bukkit.getScheduler().runTaskLater(KSpigotMainInstance, runnable, delay)
else else
@@ -120,7 +120,7 @@ fun bukkitRunLater(delay: Long, sync: Boolean = true, runnable: () -> Unit) {
* Executes the given [runnable] either * Executes the given [runnable] either
* sync or async (specified by the [sync] parameter). * sync or async (specified by the [sync] parameter).
*/ */
fun bukkitRun(sync: Boolean = true, runnable: () -> Unit) { fun taskRun(sync: Boolean = true, runnable: () -> Unit) {
if (sync) { if (sync) {
sync(runnable) sync(runnable)
} else { } else {