Why does message come out twice

Discussion in 'Plugin Development' started by xepisolonxx, Apr 13, 2014.

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

    xepisolonxx

    So when palyers die by explosion the message comes out twice any way to fix?
    Code:
            @EventHandler
            public void onPlayerDead (PlayerDeathEvent e) {
                e.setDeathMessage("");
     
              if (e.getEntity().getKiller() instanceof Player){
                  if(e.getEntity() instanceof Player){
                   
                    Player p = (Player) e.getEntity();
              Player killer = p.getKiller();
            Damageable dtarget = (Damageable)p;
     
              if (dtarget.getHealth() == 0.0){
                Bukkit.broadcastMessage(ChatColor.RED + killer.getName() + ChatColor.WHITE + " has killed " + ChatColor.GREEN + p.getName());
     
                      p.getWorld().playEffect(p.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
                                  }
                  } 
                  }
                          }
     
  2. Offline

    Timbo_KZ

    xepisolonxx
    Try setting deathMessage to your custom message rather than creating a new one.
     
Thread Status:
Not open for further replies.

Share This Page