mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
no idea how they managed to dispatch player command without / but ok
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>eu.endermite</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.7.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandWhitelist</name>
|
||||
|
||||
+4
-2
@@ -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<String, List<String>> 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<String> 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())));
|
||||
|
||||
Reference in New Issue
Block a user