mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-28 12:00:23 +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)) {
|
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent)) {
|
||||||
killer = entityLastDamager.getIfPresent(event.getEntity().getUniqueId());
|
killer = entityLastDamager.getIfPresent(event.getEntity().getUniqueId());
|
||||||
} else if (event.getEntity().getLastDamageCause().getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
|
} else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||||
if (event.getEntity().getLastDamageCause().getDamageSource() != null)
|
EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause();
|
||||||
killer = event.getEntity().getLastDamageCause().getDamageSource().getCausingEntity();
|
if (entityEvent.getDamager() != null)
|
||||||
|
killer = entityEvent.getDamager();
|
||||||
} else {
|
} else {
|
||||||
killer = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
killer = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user