mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-03 23:08:07 +01:00
get entity from damage event, not from death
This commit is contained in:
parent
b0a699433a
commit
e9c30dba79
@ -793,16 +793,21 @@ public class JobsPaymentListener implements Listener {
|
|||||||
//disabling plugin in world
|
//disabling plugin in world
|
||||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
// Entity that died must be living
|
|
||||||
LivingEntity lVictim = event.getEntity();
|
|
||||||
|
|
||||||
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
|
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause();
|
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
|
//extra check for Citizens 2 sentry kills
|
||||||
if (e.getDamager() instanceof Player)
|
if (e.getDamager() instanceof Player)
|
||||||
if (lVictim.getKiller().hasMetadata("NPC"))
|
if (e.getDamager().hasMetadata("NPC"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Jobs.getGCManager().MythicMobsEnabled && Jobs.getMythicManager().MMAPI != null) {
|
if (Jobs.getGCManager().MythicMobsEnabled && Jobs.getMythicManager().MMAPI != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user