Skip to content

Commit

Permalink
Add amount argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Emirlol committed Nov 23, 2024
1 parent b8ed605 commit 6693833
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,8 +73,10 @@ private static void loadSackItems() {
private static LiteralCommandNode<FabricClientCommandSource> createCommandNode(String command, Set<String> 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 <amount> text to the suggestion when any number is entered after the item string
)
.build();
}
}

0 comments on commit 6693833

Please sign in to comment.