diff options
author | nea <nea@nea.moe> | 2023-08-15 19:34:56 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-08-15 19:38:27 +0200 |
commit | 8c5570bfe6ab93855e24e6924fac1105fe8342ff (patch) | |
tree | 71c412ffefede775f36411531fed089d21b6d49d /src/main/kotlin/moe/nea/firmament/commands/dsl.kt | |
parent | b32f5da88c355645a9eaf343987f10506aa25bee (diff) | |
download | firmament-8c5570bfe6ab93855e24e6924fac1105fe8342ff.tar.gz firmament-8c5570bfe6ab93855e24e6924fac1105fe8342ff.tar.bz2 firmament-8c5570bfe6ab93855e24e6924fac1105fe8342ff.zip |
Add ursa client
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/commands/dsl.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/commands/dsl.kt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/commands/dsl.kt b/src/main/kotlin/moe/nea/firmament/commands/dsl.kt index 01a3458..d6eaf85 100644 --- a/src/main/kotlin/moe/nea/firmament/commands/dsl.kt +++ b/src/main/kotlin/moe/nea/firmament/commands/dsl.kt @@ -16,6 +16,9 @@ import java.lang.reflect.ParameterizedType import java.lang.reflect.Type import java.lang.reflect.TypeVariable import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource +import kotlinx.coroutines.launch +import moe.nea.firmament.Firmament +import moe.nea.firmament.util.MinecraftDispatcher import moe.nea.firmament.util.iterate @@ -105,9 +108,11 @@ fun <T : ArgumentBuilder<DefaultSource, T>> T.thenLiteral( fun <T : ArgumentBuilder<DefaultSource, T>> T.then(node: ArgumentBuilder<DefaultSource, *>, block: T.() -> Unit): T = then(node).also(block) -fun <T : ArgumentBuilder<DefaultSource, T>> T.thenExecute(block: CommandContext<DefaultSource>.() -> Unit): T = +fun <T : ArgumentBuilder<DefaultSource, T>> T.thenExecute(block: suspend CommandContext<DefaultSource>.() -> Unit): T = executes { - block(it) + Firmament.coroutineScope.launch(MinecraftDispatcher) { + block(it) + } 1 } |