[HELP] Advance PlayerDeathEvent

Discussion in 'Spigot Plugin Development' started by Tauchet, May 3, 2015.

  1. Hello,
    let me know when a player kills another either by lava or fall of the island is for a plugin skywars.
    As the plugin Skywars of CubeCraftGames server.
  2. What are you talking about?
  3. let's say a player you from death for killing a player by throwing an island
  4. I suppose a player shot the island and to me that says death "Tauchet died for Test"
  5. I think the game already does that for you only need to call the killer in the event.
  6. Code (Java):
        public void onDeath(EntityDeathEvent e) {
            Entity ent = e.getEntity();
            EntityDamageEvent ede = ent.getLastDamageCause();
            DamageCause dc = ede.getCause();
            if (ent instanceof Player) {
                Player p = (Player) ent;
                if (dc == DamageCause.VOID) {
                    // Stuff
                } else if (dc == DamageCause.LAVA) {
                    // Other Stuff
    Note that the LAVA damagecause will only take effect if they died while inside lava, if you'd like to check if they burned to death, use the FIRE damagecause.
  7. Check the damage cause.