From 81b5f58574d5ea9116f4ef0bb0c0e095f83e21a0 Mon Sep 17 00:00:00 2001 From: nea Date: Fri, 20 Jan 2023 04:37:33 +0100 Subject: Restructure commands --- src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt') diff --git a/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt b/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt index c21eab8..6190d88 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt @@ -5,13 +5,19 @@ import com.mojang.brigadier.builder.ArgumentBuilder import com.mojang.brigadier.builder.LiteralArgumentBuilder import com.mojang.brigadier.builder.RequiredArgumentBuilder import com.mojang.brigadier.context.CommandContext -import moe.nea.notenoughupdates.util.iterate -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource import java.lang.reflect.ParameterizedType +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource +import moe.nea.notenoughupdates.util.iterate typealias DefaultSource = FabricClientCommandSource + +inline val > T.context get() = this +operator fun > C.get(arg: TypeSafeArg): T { + return arg.get(this) +} + fun literal( name: String, block: LiteralArgumentBuilder.() -> Unit -- cgit