diff --git a/src/main/kotlin/net/axay/kspigot/commands/BrigardierWrapper.kt b/src/main/kotlin/net/axay/kspigot/commands/BrigardierWrapper.kt index 910f5e34..413b1aa5 100644 --- a/src/main/kotlin/net/axay/kspigot/commands/BrigardierWrapper.kt +++ b/src/main/kotlin/net/axay/kspigot/commands/BrigardierWrapper.kt @@ -9,6 +9,7 @@ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType import com.mojang.brigadier.tree.LiteralCommandNode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.async import kotlinx.coroutines.future.asCompletableFuture import net.minecraft.commands.CommandListenerWrapper @@ -53,9 +54,7 @@ inline fun ArgumentBuilder.simpleExecutes( inline fun ArgumentBuilder.literal( name: String, builder: LiteralArgumentBuilder.() -> Unit, -) { - then(command(name, false, builder)) -} +) = command(name, false, builder).also { then(it) } /** * Add an argument. @@ -67,11 +66,10 @@ inline fun ArgumentBuilder.argument( name: String, type: ArgumentType, builder: RequiredArgumentBuilder.() -> Unit, -) { - then(RequiredArgumentBuilder.argument(name, type).apply(builder)) -} +): RequiredArgumentBuilder = + RequiredArgumentBuilder.argument(name, type).apply(builder).also { then(it) } -private val argumentCoroutineScope = CoroutineScope(Dispatchers.IO) +private val argumentCoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) /** * Add custom suspending suggestion logic for an argument.