diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/AsyncTabCompleteBlockerListener.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/AsyncTabCompleteBlockerListener.java index 87fb772..2001da2 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/AsyncTabCompleteBlockerListener.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/AsyncTabCompleteBlockerListener.java @@ -9,7 +9,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; - public class AsyncTabCompleteBlockerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) @@ -18,8 +17,14 @@ public void onCommandTabComplete(AsyncTabCompleteEvent event) { Player player = (Player) event.getSender(); if (player.hasPermission(CWPermission.BYPASS.permission())) return; String buffer = event.getBuffer(); - if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) event.setCancelled(true); - if (event.getCompletions().isEmpty()) return; + if ((buffer.split(" ").length == 1 && !buffer.endsWith(" ")) || !buffer.startsWith("/")) { + CommandWhitelistBukkit.getConfigCache().debug("Actively prevented "+event.getSender().getName()+"'s tab completion (sus packet)"); + event.setCancelled(true); + return; + } + if (event.getCompletions().isEmpty()) { + return; + } event.setCompletions(CommandUtil.filterSuggestions(buffer, event.getCompletions(), CommandWhitelistBukkit.getSuggestions(player))); } diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/TabCompleteBlockerListener.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/TabCompleteBlockerListener.java index a924259..9ea1088 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/TabCompleteBlockerListener.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/TabCompleteBlockerListener.java @@ -17,13 +17,12 @@ public void onCommandTabComplete(TabCompleteEvent event) { Player player = (Player) event.getSender(); if (player.hasPermission(CWPermission.BYPASS.permission())) return; String buffer = event.getBuffer(); - if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) { - CommandWhitelistBukkit.getConfigCache().debug("Actively prevented "+event.getSender().getName()+"'s tab completion (/[tab] packet)"); + if ((buffer.split(" ").length == 1 && !buffer.endsWith(" ")) || !buffer.startsWith("/")) { + CommandWhitelistBukkit.getConfigCache().debug("Actively prevented "+event.getSender().getName()+"'s tab completion (sus packet)"); event.setCancelled(true); return; } if (event.getCompletions().isEmpty()) { - CommandWhitelistBukkit.getConfigCache().debug("Tab completion not provided"); return; } event.setCompletions(