mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-27 03:17:49 +01:00
Lets use EntityDamageByEntityEvent to get killer
This commit is contained in:
parent
5d823a1d81
commit
1d3b15ab87
@ -1305,9 +1305,10 @@ public final class JobsPaymentListener implements Listener {
|
||||
|
||||
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent)) {
|
||||
killer = entityLastDamager.getIfPresent(event.getEntity().getUniqueId());
|
||||
} else if (event.getEntity().getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
|
||||
if (event.getEntity().getLastDamageCause().getDamageSource() != null)
|
||||
killer = event.getEntity().getLastDamageCause().getDamageSource().getCausingEntity();
|
||||
} else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause();
|
||||
if (entityEvent.getDamager() != null)
|
||||
killer = entityEvent.getDamager();
|
||||
} else {
|
||||
killer = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user