From e9c30dba7956f0ffb08db2aebe10b30a72ae75ae Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 27 Jun 2016 14:59:04 +0300 Subject: [PATCH] get entity from damage event, not from death --- .../jobs/listeners/JobsPaymentListener.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 7823aebd..1094db51 100644 --- a/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -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) {