aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java40
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java57
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java131
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt10
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt144
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt16
8 files changed, 166 insertions, 281 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
index e530809a..0c8597bb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
@@ -20,12 +20,6 @@
package io.github.moulberry.notenoughupdates.commands;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.dev.DiagCommand;
-import io.github.moulberry.notenoughupdates.commands.dev.PackDevCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.DhCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.DnCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.JoinDungeonCommand;
-import io.github.moulberry.notenoughupdates.commands.dungeon.MapCommand;
import io.github.moulberry.notenoughupdates.commands.misc.AhCommand;
import io.github.moulberry.notenoughupdates.commands.misc.CalculatorCommand;
import io.github.moulberry.notenoughupdates.commands.misc.CalendarCommand;
@@ -52,12 +46,6 @@ public class Commands {
ClientCommandHandler.instance.registerCommand(new PvCommand());
if (!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(new CataCommand());
- // Dungeon Commands
- ClientCommandHandler.instance.registerCommand(new MapCommand());
- ClientCommandHandler.instance.registerCommand(new JoinDungeonCommand());
- ClientCommandHandler.instance.registerCommand(new DnCommand());
- ClientCommandHandler.instance.registerCommand(new DhCommand());
-
// Misc Commands
ClientCommandHandler.instance.registerCommand(new CosmeticsCommand());
ClientCommandHandler.instance.registerCommand(new CustomizeCommand());
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java
deleted file mode 100644
index 222862f9..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DhCommand.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-
-public class DhCommand extends ClientCommandBase {
-
- public DhCommand() {
- super("dh");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub");
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java
deleted file mode 100644
index 3b697905..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/DnCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.EnumChatFormatting;
-
-public class DnCommand extends ClientCommandBase {
-
- public DnCommand() {
- super("dn");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub");
- Utils.addChatMessage(EnumChatFormatting.AQUA + "Warping to:" + EnumChatFormatting.YELLOW + " Deez Nuts lmao");
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java
deleted file mode 100644
index 58bfbef2..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/JoinDungeonCommand.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.EnumChatFormatting;
-import org.apache.commons.lang3.StringUtils;
-
-public class JoinDungeonCommand extends ClientCommandBase {
-
- public JoinDungeonCommand() {
- super("join");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/join " + StringUtils.join(args, " "));
- } else {
- if (args.length != 1) {
- Utils.addChatMessage(EnumChatFormatting.RED + "Example Usage: /join f7, /join m6 or /join 7");
- } else {
- String cataPrefix = "catacombs";
- if (args[0].toLowerCase().startsWith("m")) {
- cataPrefix = "master_catacombs";
- }
- String cmd = "/joindungeon " + cataPrefix + " " + args[0].charAt(args[0].length() - 1);
- Utils.addChatMessage(EnumChatFormatting.YELLOW + "Running command: " + cmd);
- Utils.addChatMessage(EnumChatFormatting.YELLOW +
- "The dungeon should start soon. If it doesn't, make sure you have a party of 5 people");
- Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd);
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
deleted file mode 100644
index d52ed196..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.commands.dungeon;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
-import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.block.material.MapColor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.item.ItemMap;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.storage.MapData;
-
-import java.awt.*;
-import java.io.File;
-import java.util.Map;
-
-public class MapCommand extends ClientCommandBase {
-
- public MapCommand() {
- super("neumap");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
-
- if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
- NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(null);
- return;
- }
-
- if (args.length == 1 && args[0].equals("reset")) {
- NotEnoughUpdates.INSTANCE.colourMap = null;
- return;
- }
-
- if (args.length != 2) {
- NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(null);
- return;
- }
-
- if (args[0].equals("save")) {
- ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
- if (stack != null && stack.getItem() instanceof ItemMap) {
- ItemMap map = (ItemMap) stack.getItem();
- MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld);
-
- if (mapData == null) return;
-
- JsonObject json = new JsonObject();
- for (int i = 0; i < 16384; ++i) {
- int x = i % 128;
- int y = i / 128;
-
- int j = mapData.colors[i] & 255;
-
- Color c;
- if (j / 4 == 0) {
- c = new Color((i + i / 128 & 1) * 8 + 16 << 24, true);
- } else {
- c = new Color(MapColor.mapColorArray[j / 4].getMapColor(j & 3), true);
- }
-
- json.addProperty(x + ":" + y, c.getRGB());
- }
-
- try {
- new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps").mkdirs();
- NotEnoughUpdates.INSTANCE.manager.writeJson(
- json,
- new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps/" + args[1] + ".json")
- );
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- Utils.addChatMessage(EnumChatFormatting.GREEN + "Saved to file.");
- }
-
- return;
- }
-
- if (args[0].equals("load")) {
- JsonObject json = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(new File(
- NotEnoughUpdates.INSTANCE.manager.configLocation,
- "maps/" + args[1] + ".json"
- ));
-
- NotEnoughUpdates.INSTANCE.colourMap = new Color[128][128];
- for (int x = 0; x < 128; x++) {
- for (int y = 0; y < 128; y++) {
- NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(0, 0, 0, 0);
- }
- }
- for (Map.Entry<String, JsonElement> entry : json.entrySet()) {
- int x = Integer.parseInt(entry.getKey().split(":")[0]);
- int y = Integer.parseInt(entry.getKey().split(":")[1]);
-
- NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(entry.getValue().getAsInt(), true);
- }
-
- return;
- }
-
- NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(null);
- }
-}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
index 351c0fa9..7647ca2c 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -88,13 +88,17 @@ class DevTestCommand {
SPECIAL_KICK,
"Ok, this is actually the last message, use the command again and you'll crash I promise"
)
+
+ fun isDeveloper(commandSender: ICommandSender): Boolean {
+ return DEV_TESTERS.contains((commandSender as? EntityPlayer)?.uniqueID?.toString())
+ || Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
+
+ }
}
var devFailIndex = 0
-
fun canPlayerExecute(commandSender: ICommandSender): Boolean {
- return DEV_TESTERS.contains((commandSender as? EntityPlayer)?.uniqueID?.toString())
- || Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
+ return isDeveloper(commandSender)
}
@SubscribeEvent
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt
new file mode 100644
index 00000000..514f7be0
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/DungeonCommands.kt
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2023 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.commands.misc
+
+import com.google.gson.JsonObject
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.block.material.MapColor
+import net.minecraft.client.Minecraft
+import net.minecraft.item.ItemMap
+import net.minecraft.util.EnumChatFormatting.GREEN
+import net.minecraft.util.EnumChatFormatting.RED
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.awt.Color
+
+@NEUAutoSubscribe
+class DungeonCommands {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("dh") {
+ thenExecute {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub")
+ }
+ }.withHelp("Warps to the dungeon hub")
+ event.command("dn") {
+ thenExecute {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub")
+ reply("Warping to...")
+ reply("Deez nuts lmao")
+ }
+ }.withHelp("Warps to the dungeon nuts")
+ event.command("join") {
+ thenArgument("floor", string()) { floor ->
+ suggests((1..7).flatMap { listOf("f$it", "m$it") })
+ thenExecute {
+ val floor = this[floor]
+ val prefix = if (floor.startsWith("m")) "master_catacombs" else "catacombs"
+ val level = floor.lastOrNull()?.digitToIntOrNull()
+ val cmd = "/joindungeon $prefix ${floor.lastOrNull()}"
+ reply("Running command: $cmd")
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd)
+ }
+ }.withHelp("Join a dungeon floor with a party of 5")
+ }
+ event.command("neumap") {
+ thenLiteral("reset") {
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.colourMap = null
+ reply("Reset color map")
+ }
+ requiresDev()
+ }.withHelp("Reset the colour map")
+ thenLiteral("save") {
+ thenArgument("filename", string()) { fileName ->
+ requiresDev()
+ thenExecute {
+ val stack = Minecraft.getMinecraft().thePlayer.heldItem
+ if (stack == null || stack.item !is ItemMap) {
+ reply("Please hold a map item")
+ return@thenExecute
+ }
+ val map = stack.item as ItemMap
+ val mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld)
+ if (mapData == null) {
+ reply("Could not grab map data (empty map)")
+ return@thenExecute
+ }
+ val json = JsonObject()
+ for (i in 0 until (128 * 128)) {
+ val x = i % 128
+ val y = i / 128
+ val j = mapData.colors[i].toInt() and 255
+ val c = if (j / 4 == 0) {
+ Color((i + i / 128 and 1) * 8 + 16 shl 24, true)
+ } else {
+ Color(MapColor.mapColorArray[j / 4].getMapColor(j and 3), true)
+ }
+ json.addProperty("$x:$y", c.rgb)
+ }
+ try {
+ NotEnoughUpdates.INSTANCE.manager.configLocation.resolve("maps").mkdirs()
+ NotEnoughUpdates.INSTANCE.manager.writeJson(
+ json,
+ NotEnoughUpdates.INSTANCE.manager.configLocation.resolve("maps/${this[fileName]}.json")
+ )
+ reply("${GREEN}Saved to file.")
+ } catch (e: Exception) {
+ e.printStackTrace()
+ reply("${RED}Failed to save.")
+ }
+ }
+ }
+ }.withHelp("Save a colour map from an item")
+ thenLiteral("load") {
+ thenArgument("filename", string()) { fileName ->
+ requiresDev()
+ thenExecute {
+ val json = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(
+ NotEnoughUpdates.INSTANCE.manager.configLocation.resolve(
+ "maps/${this[fileName]}.json"
+ )
+ )
+ NotEnoughUpdates.INSTANCE.colourMap = (0 until 128).map { x ->
+ (0 until 128).map { y ->
+ val key = "$x:$y"
+ json[key]?.asInt?.let { Color(it, true) } ?: Color(0, 0, 0, 0)
+ }.toTypedArray()
+ }.toTypedArray()
+ for (x in 0..127) {
+ for (y in 0..127) {
+ NotEnoughUpdates.INSTANCE.colourMap[x][y] = Color(0, 0, 0, 0)
+ }
+ }
+ reply("Loaded colour map from file")
+ }
+ }
+ }.withHelp("Load a colour map from a file")
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.openGui = GuiDungeonMapEditor(null)
+ }
+ }.withHelp("Open the dungeon map editor")
+ }
+}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt
index f6a326dc..1b840a07 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/brigadier/dsl.kt
@@ -27,11 +27,11 @@ import com.mojang.brigadier.context.CommandContext
import com.mojang.brigadier.tree.ArgumentCommandNode
import com.mojang.brigadier.tree.CommandNode
import com.mojang.brigadier.tree.LiteralCommandNode
+import io.github.moulberry.notenoughupdates.commands.dev.DevTestCommand
import io.github.moulberry.notenoughupdates.util.iterate
import net.minecraft.command.ICommandSender
import net.minecraft.util.ChatComponentText
import net.minecraft.util.IChatComponent
-import java.lang.RuntimeException
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
import java.lang.reflect.TypeVariable
@@ -152,6 +152,11 @@ fun <T : ArgumentBuilder<DefaultSource, T>> T.thenExecute(block: CommandContext<
1
}
+fun <T : ArgumentBuilder<DefaultSource, T>> T.requiresDev(): T {
+ requires { DevTestCommand.isDeveloper(it) }
+ return this
+}
+
fun NEUBrigadierHook.withHelp(helpText: String): NEUBrigadierHook {
commandNode.withHelp(helpText)
return this
@@ -162,4 +167,13 @@ fun <T : CommandNode<DefaultSource>> T.withHelp(helpText: String): T {
return this
}
+fun <A : Any, T : RequiredArgumentBuilder<DefaultSource, A>> T.suggests(list: List<String>) {
+ suggests { context, builder ->
+ list.filter { it.startsWith(builder.remaining, ignoreCase = true) }
+ .forEach { builder.suggest(it) }
+ builder.buildFuture()
+ }
+}
+
+