Why doesn't this work!?!

Discussion in 'Plugin Development' started by Milkywayz, Apr 24, 2012.

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

    Milkywayz

    This code is supposed to send a message to players with permission:
    PHP:
    public void alerter(PlayerInteractEvent e) {
            if(
    plugin.getConfig().getBoolean("Send-Alerts")) {
            
    plugin.alert(ChatColor.GREEN "[EM] " ChatColor.DARK_RED
                    
    e.getPlayer().getDisplayName() + " tryed to use a "
                    
    ChatColor.GOLD e.getItem().getType().toString().toLowerCase() + ".");
        }
        }
    This is the alert code in the main class AKA plugin:
    PHP:
    public void alert(String message) {
                for (final 
    Player player this.getServer().getOnlinePlayers()) {
                    if ((
    player != null) && player.hasPermission("entitymanager.admin")) {
                        
    player.sendMessage(message);
                    }
                }
            }
    This is how i use the alerter code:
    PHP:
     if (e.getItem().getTypeId() == 384) {
                                if (
    plugin.getConfig().getBoolean(
                                        
    "block.Throw.XpBottles")
                                        && !
    player
                                                
    .hasPermission("entitymanager.xpbottles")) {
                                    
    e.setCancelled(true);
                                    
    alerter(e);
                                    
    messager(e);
                                    return;
                                }
                            }
     
  2. Offline

    Ne0nx3r0

    I assume you have a onPlayerInteract event registered; if so you probably just need to spit out debug messages with your variables until you find where the disconnect is.
     
Thread Status:
Not open for further replies.

Share This Page