From 990339499a04a8fd7614aded279eeba022cd075a Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sun, 27 Feb 2022 14:51:37 +0100 Subject: [PATCH] Fixes list paid signs tab completion --- .../net/knarcraft/paidsigns/command/ListCommand.java | 11 +++++++---- .../knarcraft/paidsigns/command/ListTabCompleter.java | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java b/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java index a1cb388..02e5d75 100644 --- a/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java +++ b/src/main/java/net/knarcraft/paidsigns/command/ListCommand.java @@ -47,7 +47,7 @@ public class ListCommand extends TokenizedCommand { } else { short signLine; try { - signLine = Short.parseShort(arguments.get(1)); + signLine = (short) (Short.parseShort(arguments.get(1)) - 1); } catch (NumberFormatException exception) { sender.sendMessage("Invalid number given"); return false; @@ -57,7 +57,7 @@ public class ListCommand extends TokenizedCommand { return false; } PaidSignCondition condition = paidSign.getConditions().get(signLine); - displayPaidSignCondition(sender, paidSign.getName(), condition); + displayPaidSignCondition(sender, paidSign.getName(), signLine, condition); } return true; } @@ -67,11 +67,14 @@ public class ListCommand extends TokenizedCommand { * * @param sender

The command sender to display the information to

* @param signName

The name of the sign to display the condition for

+ * @param signLine

The line the condition is for

* @param condition

The condition to display information about

*/ - private void displayPaidSignCondition(CommandSender sender, String signName, PaidSignCondition condition) { + private void displayPaidSignCondition(CommandSender sender, String signName, short signLine, + PaidSignCondition condition) { sender.sendMessage("Paid sign condition info: "); sender.sendMessage("Paid sign name: " + signName); + sender.sendMessage("Condition line: " + signLine); sender.sendMessage("Condition match string: " + condition.getStringToMatch()); sender.sendMessage("Execute RegEx: " + condition.executeRegex()); sender.sendMessage("Ignore case: " + condition.ignoreCase()); @@ -94,7 +97,7 @@ public class ListCommand extends TokenizedCommand { sender.sendMessage("Sign conditions: "); Map conditions = paidSign.getConditions(); for (short lineIndex : conditions.keySet()) { - sender.sendMessage(" | " + lineIndex + ". " + conditions.get(lineIndex).getStringToMatch()); + sender.sendMessage(" | " + (lineIndex + 1) + ". " + conditions.get(lineIndex).getStringToMatch()); } } diff --git a/src/main/java/net/knarcraft/paidsigns/command/ListTabCompleter.java b/src/main/java/net/knarcraft/paidsigns/command/ListTabCompleter.java index 7dc1afa..ddeeb3b 100644 --- a/src/main/java/net/knarcraft/paidsigns/command/ListTabCompleter.java +++ b/src/main/java/net/knarcraft/paidsigns/command/ListTabCompleter.java @@ -20,6 +20,7 @@ public class ListTabCompleter extends TokenizedTabCompleter { @Override public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) { + super.onTabComplete(sender, command, alias, args); if (argumentSize == 1) { return TabCompleteHelper.filterMatchingStartsWith(TabCompleteHelper.getPaidSignNames(), arguments.get(0)); } else if (argumentSize == 2) {