Fix Kill Detection when the player is killed by an Arrow

This commit is contained in:
Fuzzlemann 2017-08-21 16:53:09 +02:00
parent 8640520af9
commit 76a79c8c57

View File

@ -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"));
}
}
}