EntityDamageByEntityEvent no error log

Discussion in 'Plugin Development' started by MajorSkillage, Mar 3, 2015.

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

    MajorSkillage

    I get no error but the player doesn't get sent anything, my 2nd if statement has an else statement so either way it should at least message someone if they die from another player or the damager gets send a msg. It means the first if statement there is something wrong with it.

    Code:
        @EventHandler
        public void onKill(EntityDamageByEntityEvent e){
            Entity dmger1 = e.getDamager();
            Entity dmged1 = (Player)e.getEntity();
            if(dmger1 instanceof Player && dmged1 instanceof Player && e.getEntity().isDead()){
            Player dmger = (Player)e.getDamager();
            Player dmged = (Player)e.getEntity();
            saveConfig();
            if(!getConfig().getString("killmessage " + dmger.getUniqueId()).equals(null)){
                dmged.sendMessage(format("killmessage " + dmger.getUniqueId()));
            } else {
                dmger.sendMessage(ChatColor.RED +"I see you have not set a kill message yet, you can do this with /km (message), this message will be messaged to the player you killed!");
            }
            }
        }
     
  2. Your events are registered ?
    Don't cast the entity to a player until you know it is a player
    player.getUniqueId().toString()
    I think you saved the message something like this :
    Code:java
    1.  
    2. killmessage:
    3. uuid: message
    4.  

    If you did it, you have to get the message with getConfig().getString("killmessage." + dmger.getUniqueId().toString()), and don't forget the point .
     
Thread Status:
Not open for further replies.

Share This Page