tab completion now fails gracefully if command is not registered (cannot block completions that are not registered)

This commit is contained in:
YouHaveTrouble
2020-12-06 14:47:56 +01:00
parent b9db85278c
commit 9254c7fc7b
2 changed files with 5 additions and 3 deletions
@@ -22,10 +22,12 @@ public class TabCompleteBlockerListener implements Listener {
String slast = CommandsList.getLastArgument(s);
String scommand = s.replace(slast, "");
cmd = cmd.replace(CommandsList.getLastArgument(cmd), "");
if (cmd.startsWith("/"+scommand+" ")) {
if (cmd.startsWith("/" + scommand + " ")) {
continue;
}
suggestions.remove(slast);
try {
suggestions.remove(slast);
} catch (Exception ignored) {}
}
event.setCompletions(suggestions);
}