protected void processGravity(SimpleGravityKillTracker gravity, PlayerDeath death) { Player p = death.getVictim(); if (gravity.attacks.containsKey(p)) { Attack attack = gravity.attacks.remove(p); if (gravity.wasAttackFatal(attack, death.getCause(), 200)) { EntityDamageEvent.DamageCause damageCause = death.getCause(); death.setAction(DeathMessageUtils.getCauseOfAttack(attack.cause)); death.setFrom(DeathMessageUtils.getWhereFrom(attack.from)); death.setTo(DeathMessageUtils.getWhereTo(attack.from, damageCause)); death.setKiller(attack.attacker); } } }
protected void processWeapon(PlayerDeath death) { if (death.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK) { if (death.getCredited() != null) { String weapon = ""; ItemStack item = death.getCredited().getItemInHand(); if (item.getType() == Material.AIR) { weapon = "fists"; } else { if (DeathMessageUtils.getName(item) != null) { weapon = DeathMessageUtils.getName(item); } } death.setItemStack(weapon); } } }
protected void processDefaults(PlayerDeath death) { death.setEvent(death.getVictim().getLastDamageCause()); if (death.getEvent() instanceof EntityDamageByEntityEvent) { EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent) death.getEvent(); Entity killerEntity = entityEvent.getDamager(); if (killerEntity instanceof LivingEntity) { LivingEntity killer = (LivingEntity) killerEntity; death.setKiller(killer); } } String attack = DeathMessageUtils.getDamageAction(death.getCause()); death.setAction(attack); }