mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-28 21:45:47 +01:00
Fix edit command tab completion
This commit is contained in:
parent
cce4b80a80
commit
2f451a7228
@ -123,6 +123,7 @@ public class EditSubCommand extends SubCommand {
|
||||
public List<String> onTabComplete(CommandSender sender, String... args) {
|
||||
String[] argsWithoutLast = Arrays.copyOf(args, Math.max(0, args.length - 1));
|
||||
|
||||
boolean isItemSet = !getNamedArgs(ITEM_ARGS, argsWithoutLast).isEmpty();
|
||||
boolean isAmountSet = !getNamedArgs(AMOUNT_ARGS, argsWithoutLast).isEmpty();
|
||||
boolean isBuyPriceSet = !getNamedArgs(BUY_PRICE_ARGS, argsWithoutLast).isEmpty();
|
||||
boolean isSellPriceSet = !getNamedArgs(SELL_PRICE_ARGS, argsWithoutLast).isEmpty();
|
||||
@ -131,6 +132,10 @@ public class EditSubCommand extends SubCommand {
|
||||
|
||||
List<String> ret = new ArrayList<>();
|
||||
|
||||
if (!isItemSet) {
|
||||
ITEM_ARGS.stream().filter(arg -> arg.startsWith(lastArg)).findFirst().ifPresent(ret::add);
|
||||
}
|
||||
|
||||
if (!isAmountSet) {
|
||||
AMOUNT_ARGS.stream().filter(arg -> arg.startsWith(lastArg)).findFirst().ifPresent(ret::add);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user