mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-11 22:16:57 +00:00
waterfall impl
This commit is contained in:
+16
@@ -106,4 +106,20 @@ public final class CommandWhitelistWaterfall extends Plugin {
|
||||
}
|
||||
return suggestionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Command denied message. Will use custom if command exists in any group.
|
||||
*/
|
||||
public static String getCommandDeniedMessage(String command) {
|
||||
String commandDeniedMessage = configCache.command_denied;
|
||||
HashMap<String, CWGroup> groups = configCache.getGroupList();
|
||||
for (CWGroup group : groups.values()) {
|
||||
if (group.getCommands().contains(command)) {
|
||||
if (group.getCommandDeniedMessage() == null) continue;
|
||||
commandDeniedMessage = group.getCommandDeniedMessage();
|
||||
break; // get first message we find
|
||||
}
|
||||
}
|
||||
return commandDeniedMessage;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class BungeeChatEventListener implements Listener {
|
||||
HashSet<String> commands = CommandWhitelistWaterfall.getCommands(player);
|
||||
if (!commands.contains(label)) {
|
||||
event.setCancelled(true);
|
||||
CommandWhitelistWaterfall.getAudiences().player(player).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.command_denied));
|
||||
CommandWhitelistWaterfall.getAudiences().player(player).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + CommandWhitelistWaterfall.getCommandDeniedMessage(label)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user