mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 14:36:56 +00:00
prevented saving duplicate command entries
This commit is contained in:
@@ -52,6 +52,9 @@ public class ConfigCache {
|
||||
}
|
||||
public boolean addCommand(String command, String group) {
|
||||
try {
|
||||
if (this.permList.get(group).contains(command)) {
|
||||
return true;
|
||||
}
|
||||
this.permList.get(group).add(command);
|
||||
this.config.set("commands."+group, permList.get(group));
|
||||
config.save(CommandWhitelist.getPlugin().getDataFolder()+"/config.yml");
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class PlayerCommandPreProcessListener implements Listener {
|
||||
String rawCmd = event.getMessage();
|
||||
List<String> bannedSubCommands = CommandsList.getSuggestions(player);
|
||||
for (String bannedSubCommand : bannedSubCommands) {
|
||||
if (rawCmd.equalsIgnoreCase("/"+bannedSubCommand) || rawCmd.equalsIgnoreCase("/"+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