diff --git a/CommandWhitelistBukkit/pom.xml b/CommandWhitelistBukkit/pom.xml index 449e1f3..acfffd6 100644 --- a/CommandWhitelistBukkit/pom.xml +++ b/CommandWhitelistBukkit/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.2 + 2.2.3 Bukkit diff --git a/CommandWhitelistCommon/pom.xml b/CommandWhitelistCommon/pom.xml index ac11f74..cb4310d 100644 --- a/CommandWhitelistCommon/pom.xml +++ b/CommandWhitelistCommon/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.2 + 2.2.3 Common diff --git a/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/CommandUtil.java b/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/CommandUtil.java index 0ffe833..0e6ac9a 100644 --- a/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/CommandUtil.java +++ b/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/CommandUtil.java @@ -17,15 +17,17 @@ public class CommandUtil { public static List filterSuggestions(String buffer, Collection suggestions, Collection blockedSubCommands) { if (buffer.startsWith("/")) buffer = buffer.substring(1); + List suggestionsList = new ArrayList<>(suggestions); + if (suggestions.isEmpty() || blockedSubCommands.isEmpty()) return suggestionsList; for (String s : blockedSubCommands) { - String slast = getLastArgument(s); String scommand = cutLastArgument(s); if (buffer.startsWith(scommand)) { - while (suggestions.contains(slast)) - suggestions.remove(slast); + String slast = getLastArgument(s); + while (suggestionsList.contains(slast)) + suggestionsList.remove(slast); } } - return new ArrayList<>(suggestions); + return suggestionsList; } /** diff --git a/CommandWhitelistVelocity/pom.xml b/CommandWhitelistVelocity/pom.xml index d803df6..b29936c 100644 --- a/CommandWhitelistVelocity/pom.xml +++ b/CommandWhitelistVelocity/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.2 + 2.2.3 Velocity diff --git a/CommandWhitelistWaterfall/pom.xml b/CommandWhitelistWaterfall/pom.xml index 5d42029..896de22 100644 --- a/CommandWhitelistWaterfall/pom.xml +++ b/CommandWhitelistWaterfall/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.2 + 2.2.3 Waterfall diff --git a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeTabcompleteListener.java b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeTabcompleteListener.java index 0a78900..a9b22ec 100644 --- a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeTabcompleteListener.java +++ b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeTabcompleteListener.java @@ -13,15 +13,13 @@ public class BungeeTabcompleteListener implements Listener { public void onTabcomplete(net.md_5.bungee.api.event.TabCompleteEvent event) { if (!(event.getReceiver() instanceof ProxiedPlayer)) return; ProxiedPlayer player = (ProxiedPlayer) event.getReceiver(); + if (event.getSuggestions().isEmpty()) return; if (player.hasPermission(CWPermission.BYPASS.permission())) return; - CommandUtil.filterSuggestions( event.getCursor(), event.getSuggestions(), CommandWhitelistWaterfall.getSuggestions(player) ); - - } } diff --git a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/WaterfallDefineCommandsListener.java b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/WaterfallDefineCommandsListener.java index e6e1cf8..7f26aae 100644 --- a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/WaterfallDefineCommandsListener.java +++ b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/WaterfallDefineCommandsListener.java @@ -15,8 +15,7 @@ public class WaterfallDefineCommandsListener implements Listener { public void onProxyDefineCommandsEvent(io.github.waterfallmc.waterfall.event.ProxyDefineCommandsEvent event) { if (event.getReceiver() instanceof ProxiedPlayer) { ProxiedPlayer player = (ProxiedPlayer) event.getReceiver(); - if (player.hasPermission(CWPermission.BYPASS.permission())) - return; + if (player.hasPermission(CWPermission.BYPASS.permission())) return; HashMap commandHashMap = new HashMap<>(); CommandWhitelistWaterfall.getCommands(player).forEach(cmdName -> CommandWhitelistWaterfall.getPlugin().getProxy().getPluginManager().getCommands() diff --git a/CommandWhitelistWaterfall/src/main/resources/bungee.yml b/CommandWhitelistWaterfall/src/main/resources/bungee.yml index f01abb7..90938fe 100644 --- a/CommandWhitelistWaterfall/src/main/resources/bungee.yml +++ b/CommandWhitelistWaterfall/src/main/resources/bungee.yml @@ -1,4 +1,5 @@ name: CommandWhitelist +author: YouHaveTrouble version: ${project.version} main: eu.endermite.commandwhitelist.waterfall.CommandWhitelistWaterfall description: You decide what commands players can use or tab complete on your server! diff --git a/pom.xml b/pom.xml index 509ecf7..4c97276 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.2 + 2.2.3 CommandWhitelistCommon CommandWhitelistBukkit