mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 03:27:37 +01:00
Fix Kill Detection when the player is killed by an Arrow
This commit is contained in:
parent
8640520af9
commit
76a79c8c57
@ -14,6 +14,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
/**
|
||||
* Event Listener for EntityDeathEvents.
|
||||
@ -88,6 +89,20 @@ public class PlanDeathEventListener implements Listener {
|
||||
|
||||
handler.addToPool(new KillInfo(owner.getUniqueId(), time, dead, "Wolf"));
|
||||
}
|
||||
|
||||
if (killerEntity instanceof Arrow) {
|
||||
Arrow arrow = (Arrow) killerEntity;
|
||||
|
||||
ProjectileSource source = arrow.getShooter();
|
||||
|
||||
if (!(source instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) source;
|
||||
|
||||
handler.addToPool(new KillInfo(player.getUniqueId(), time, dead, "Bow"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user