1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-31 21:37:57 +01:00

get entity from damage event, not from death

This commit is contained in:
Zrips 2016-06-27 14:59:04 +03:00
parent b0a699433a
commit e9c30dba79

View File

@ -793,16 +793,21 @@ public class JobsPaymentListener implements Listener {
//disabling plugin in world
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
return;
// Entity that died must be living
LivingEntity lVictim = event.getEntity();
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
return;
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause();
// Entity that died must be living
if (!(e.getEntity() instanceof LivingEntity))
return;
LivingEntity lVictim = (LivingEntity) e.getEntity();
//extra check for Citizens 2 sentry kills
if (e.getDamager() instanceof Player)
if (lVictim.getKiller().hasMetadata("NPC"))
if (e.getDamager().hasMetadata("NPC"))
return;
if (Jobs.getGCManager().MythicMobsEnabled && Jobs.getMythicManager().MMAPI != null) {