Really confused on a command

Discussion in 'Plugin Development' started by ClintonM0, Dec 11, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    ClintonM0

    Code:
                    if(args.length == 2 && args[0].equalsIgnoreCase("add")) {
                        plugin.getConfig().options().copyDefaults(true);
                        List<String> list = plugin.getConfig().getStringList("censored");
                        for(String censoredWords : this.plugin.getConfig().getStringList("censored"))
                        if(list.contains(args[1]) || args[1].contains(censoredWords)) {
                            sender.sendMessage(ChatColor.BLUE + "[YouSwore] " + ChatColor.RED + "Word already censored!");
                        } else {
                            list.add(args[1]);
                            plugin.getConfig().set("censored", list);
                            plugin.saveConfig();
                            sender.sendMessage(ChatColor.BLUE + "[YouSwore] " + ChatColor.GREEN + "Censor successfully rigged!");
                        }
                    }
    This code sends multiple commands. Can anyone help?

    No help?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  2. Not after 3 hours and after no research what a for each loop actually does. I'm pretty sure this is the cause of your problem but won't tell you how to fix as it's a damn simple fix if you know how the loop works.
     
    Dreeass likes this.
  3. Offline

    gomeow

    I hope you know this plugin will only censor commands...
     
  4. Offline

    ClintonM0

    I see. Ok I got it
     
Thread Status:
Not open for further replies.

Share This Page