diff --git a/pom.xml b/pom.xml index fd28cf4..0b02e8e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ eu.endermite CommandWhitelist - 1.7.3 + 1.7.4 jar CommandWhitelist diff --git a/src/main/java/eu/endermite/commandwhitelist/spigot/listeners/PlayerCommandPreProcessListener.java b/src/main/java/eu/endermite/commandwhitelist/spigot/listeners/PlayerCommandPreProcessListener.java index 2411cb4..b87f5b7 100644 --- a/src/main/java/eu/endermite/commandwhitelist/spigot/listeners/PlayerCommandPreProcessListener.java +++ b/src/main/java/eu/endermite/commandwhitelist/spigot/listeners/PlayerCommandPreProcessListener.java @@ -19,16 +19,18 @@ public class PlayerCommandPreProcessListener implements Listener { if (player.hasPermission("commandwhitelist.bypass")) return; String command = event.getMessage().toLowerCase(); + if (command.startsWith("/")) + command = command.substring(1); for (Map.Entry> s : CommandWhitelist.getConfigCache().getPermList().entrySet()) { if (!player.hasPermission("commandwhitelist.commands." + s.getKey())) continue; for (String comm : s.getValue()) { comm = comm.toLowerCase(); - if (command.equalsIgnoreCase("/" + comm) || command.startsWith("/" + comm + " ")) { + if (command.equalsIgnoreCase(comm) || command.startsWith(comm + " ")) { String rawCmd = event.getMessage(); List bannedSubCommands = CommandsList.getSuggestions(player); for (String bannedSubCommand : bannedSubCommands) { - if (rawCmd.startsWith("/"+bannedSubCommand)) { + if (rawCmd.startsWith(bannedSubCommand)) { event.setCancelled(true); ConfigCache config = CommandWhitelist.getConfigCache(); player.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getPrefix() + RandomStuff.getMessage(config.getCommandDeniedList(), config.getSubCommandDenied())));