diff --git a/api/.gradle/caches/paperweight/taskCache/reobfJar.log b/api/.gradle/caches/paperweight/taskCache/reobfJar.log index c8fcbfa..1009358 100644 --- a/api/.gradle/caches/paperweight/taskCache/reobfJar.log +++ b/api/.gradle/caches/paperweight/taskCache/reobfJar.log @@ -1,2 +1,2 @@ Command: C:\Program Files\Java\jdk-17\bin\java.exe -Xmx1G -classpath C:\Users\Mangr\.gradle\caches\modules-2\files-2.1\net.fabricmc\tiny-remapper\0.10.1\c293b2384ae12af74f407fa3aaa553bba4ac6763\tiny-remapper-0.10.1-fat.jar net.fabricmc.tinyremapper.Main D:\PC\Projects\KtBukkitGui\api\build\libs\ktgui-2.4.2-alpha-dev-all.jar D:\PC\Projects\KtBukkitGui\api\build\libs\api-2.4.2-alpha.jar C:\Users\Mangr\.gradle\caches\paperweight-userdev\ff775525efc29c3503a07d1006e63e5695a742b7505cf63e157d49d32419c69f\module\io.papermc.paper\dev-bundle\1.20.4-R0.1-SNAPSHOT\paperweight\setupCache\extractDevBundle.dir\data\mojang+yarn-spigot-reobf.tiny mojang+yarn spigot C:\Users\Mangr\.gradle\caches\paperweight-userdev\ff775525efc29c3503a07d1006e63e5695a742b7505cf63e157d49d32419c69f\module\io.papermc.paper\dev-bundle\1.20.4-R0.1-SNAPSHOT\paperweight\setupCache\applyMojangMappedPaperclipPatch.jar --threads=1 -Finished after 2923.07 ms. +Finished after 3172.69 ms. diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/DeclarativeCommandBuilder.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/DeclarativeCommandBuilder.kt index 6802130..4ffb4bb 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/DeclarativeCommandBuilder.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/DeclarativeCommandBuilder.kt @@ -222,6 +222,7 @@ open class DeclarativeCommandBuilder( val cmds = subcommands .filter { it.nameStarts(context.last) } .map { listOf(it.name) + it.aliases } + val cmdsList = cmds.flatten() val list = context.rawArgs.toMutableList() diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/MultiChoiceArgument.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/MultiChoiceArgument.kt index 194d3e5..4b97200 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/MultiChoiceArgument.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/MultiChoiceArgument.kt @@ -8,9 +8,9 @@ import com.mattmx.ktgui.commands.declarative.invocation.BaseCommandContext class MultiChoiceArgument( name: String, - initialChoices: () -> HashMap + initialChoices: () -> Map ) : Argument(name, "multi-choice") { - private val choices: () -> HashMap = initialChoices + private val choices: () -> Map = initialChoices init { this.consumes( diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/args.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/args.kt index 4a694cf..8ff55c9 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/args.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/args.kt @@ -50,10 +50,13 @@ fun flag() = delegateArgument(FlagArgument(DELEGATED_ARG_NAME)) fun multiChoiceArgument(vararg choices: Pair) = delegateArgument(MultiChoiceArgument(DELEGATED_ARG_NAME) { hashMapOf(*choices) }) -fun multiChoiceArgument(choices: HashMap) = +fun multiChoiceArgument(choices: List>) = + delegateArgument(MultiChoiceArgument(DELEGATED_ARG_NAME) { choices.toMap() }) + +fun multiChoiceArgument(choices: Map) = delegateArgument(MultiChoiceArgument(DELEGATED_ARG_NAME) { choices }) -fun multiChoiceArgument(choiceSupplier: () -> HashMap) = +fun multiChoiceArgument(choiceSupplier: () -> Map) = delegateArgument(MultiChoiceArgument(DELEGATED_ARG_NAME) { choiceSupplier() }) fun multiChoiceStringArgument(choiceSupplier: List) = diff --git a/plugin/.gradle/caches/paperweight/taskCache/reobfJar.log b/plugin/.gradle/caches/paperweight/taskCache/reobfJar.log index 0d837c4..776a89c 100644 --- a/plugin/.gradle/caches/paperweight/taskCache/reobfJar.log +++ b/plugin/.gradle/caches/paperweight/taskCache/reobfJar.log @@ -1,2 +1,2 @@ Command: C:\Program Files\Java\jdk-17\bin\java.exe -Xmx1G -classpath C:\Users\Mangr\.gradle\caches\modules-2\files-2.1\net.fabricmc\tiny-remapper\0.10.1\c293b2384ae12af74f407fa3aaa553bba4ac6763\tiny-remapper-0.10.1-fat.jar net.fabricmc.tinyremapper.Main D:\PC\Projects\KtBukkitGui\plugin\build\libs\ktgui-plugin-2.4.2-alpha-dev-all.jar D:\PC\Projects\KtBukkitGui\plugin\build\libs\plugin-unspecified.jar C:\Users\Mangr\.gradle\caches\paperweight-userdev\ff775525efc29c3503a07d1006e63e5695a742b7505cf63e157d49d32419c69f\module\io.papermc.paper\dev-bundle\1.20.4-R0.1-SNAPSHOT\paperweight\setupCache\extractDevBundle.dir\data\mojang+yarn-spigot-reobf.tiny mojang+yarn spigot C:\Users\Mangr\.gradle\caches\paperweight-userdev\ff775525efc29c3503a07d1006e63e5695a742b7505cf63e157d49d32419c69f\module\io.papermc.paper\dev-bundle\1.20.4-R0.1-SNAPSHOT\paperweight\setupCache\applyMojangMappedPaperclipPatch.jar --threads=1 -Finished after 1810.39 ms. +Finished after 1764.07 ms. diff --git a/plugin/src/main/kotlin/com/mattmx/ktgui/KotlinGui.kt b/plugin/src/main/kotlin/com/mattmx/ktgui/KotlinGui.kt index 8db7c2b..e53ec22 100644 --- a/plugin/src/main/kotlin/com/mattmx/ktgui/KotlinGui.kt +++ b/plugin/src/main/kotlin/com/mattmx/ktgui/KotlinGui.kt @@ -1,6 +1,7 @@ package com.mattmx.ktgui import com.mattmx.ktgui.commands.declarative.arg.impl.* +import com.mattmx.ktgui.commands.declarative.arg.suggests import com.mattmx.ktgui.commands.declarative.arg.suggestsTopLevel import com.mattmx.ktgui.commands.declarative.arg.withArgs import com.mattmx.ktgui.commands.declarative.div @@ -155,9 +156,9 @@ class KotlinGui : JavaPlugin() { } } - val invType by enumArgument() - - invType getStringValueOf { name.lowercase() } + val invType by multiChoiceArgument( + InventoryType.values().map { it.name.lowercase() to it } + ) invType invalid { reply(!"&cThat is not a valid inventory type.") } ("inventory" / invType) { @@ -189,7 +190,7 @@ class KotlinGui : JavaPlugin() { val target = player() reply( !"&aFound ${target.name} @ ${ - target.location.clone().toVector() + target.location.clone().toVector().toString().replace(",", ", ") } in world '${target.location.world.name}'." ) } @@ -198,6 +199,7 @@ class KotlinGui : JavaPlugin() { val msg by greedyStringArgument() msg min 1 msg invalid { reply(!"&cMust provide a valid msg (at least 1 char)") } + msg suggests { emptyList() } ("msg" / player / msg) { runs { reply(!"&f[Me -> ${player().name}]: ${msg()}")