From 6693833c94a749c24d7bbdaa29e475d964fbab38 Mon Sep 17 00:00:00 2001 From: Rime <81419447+Emirlol@users.noreply.github.com> Date: Sat, 23 Nov 2024 08:25:35 +0300 Subject: [PATCH] Add amount argument --- .../de/hysky/skyblocker/skyblock/SackItemAutocomplete.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/SackItemAutocomplete.java b/src/main/java/de/hysky/skyblocker/skyblock/SackItemAutocomplete.java index c9853d5f24..8646300c1a 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/SackItemAutocomplete.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/SackItemAutocomplete.java @@ -16,6 +16,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.logging.LogUtils; @@ -72,8 +73,10 @@ private static void loadSackItems() { private static LiteralCommandNode createCommandNode(String command, Set sackItems) { return literal(command) .requires(fccs -> Utils.isOnSkyblock()) - .then(argument("item", StringArgumentType.greedyString()) //I guess this can also cover the input of the amount - .suggests((context, builder) -> CommandSource.suggestMatching(sackItems, builder))) + .then(argument("item", StringArgumentType.greedyString()) + .suggests((context, builder) -> CommandSource.suggestMatching(sackItems, builder)) + .then(argument("amount", IntegerArgumentType.integer(0))) // Adds a nice text to the suggestion when any number is entered after the item string + ) .build(); } }