mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
tab completion now fails gracefully if command is not registered (cannot block completions that are not registered)
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>eu.endermite</groupId>
|
<groupId>eu.endermite</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>1.5.1</version>
|
<version>1.5.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandWhitelist</name>
|
<name>CommandWhitelist</name>
|
||||||
|
|||||||
+3
-1
@@ -22,10 +22,12 @@ public class TabCompleteBlockerListener implements Listener {
|
|||||||
String slast = CommandsList.getLastArgument(s);
|
String slast = CommandsList.getLastArgument(s);
|
||||||
String scommand = s.replace(slast, "");
|
String scommand = s.replace(slast, "");
|
||||||
cmd = cmd.replace(CommandsList.getLastArgument(cmd), "");
|
cmd = cmd.replace(CommandsList.getLastArgument(cmd), "");
|
||||||
if (cmd.startsWith("/"+scommand+" ")) {
|
if (cmd.startsWith("/" + scommand + " ")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
suggestions.remove(slast);
|
suggestions.remove(slast);
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
event.setCompletions(suggestions);
|
event.setCompletions(suggestions);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user