Not currently working | StringList for "messages"

Discussion in 'Spigot Plugin Development' started by Ring, Dec 30, 2015.

  1. Code (Text):
     @EventHandler
        public void onPlayerChat(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            if(!p.hasPermission("ic.staff")|| !p.isOp()){
                for (String m : this.getConfig().getStringList("messages")) {
                    if (e.getMessage().toLowerCase().contains(m)){
                        e.setCancelled(true);
                    }else{
                        e.setCancelled(false);
                    }
                for (String message : this.getConfig().getStringList("message")) {
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
                        }
                    }
                }
            }
    What is not working here?
    Code (Text):
    message:
      - '&cThis'
      - '&cis'
      - '&ca'
      - '&etest'
    messages:
      - 'test'
     
    Whatever I say it shows the message: text, not sure why? Even if I just send an empty message
     
    #1 Ring, Dec 30, 2015
    Last edited: Dec 30, 2015
  2. It was right the whole time, I was just op so it let me use it XDXDXD
     
  3. Gg