Fix handling of projectile-based kills

This commit is contained in:
Nathan Wolf 2015-02-15 12:40:47 -08:00
parent e1cc6a915d
commit 8e5e8d34bd

View File

@ -33,6 +33,7 @@ import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.inventory.ItemStack;
import org.bukkit.projectiles.ProjectileSource;
public class PlayerListener implements Listener, ColorUtil {
@ -566,19 +567,19 @@ public class PlayerListener implements Listener, ColorUtil {
public void onEntityDeath(EntityDeathEvent evt) {
if (evt.getEntity() instanceof Player == false) {
if (evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
Entity damager = damageEvent.getDamager();
if (damager != null) {
if (damager instanceof Projectile) {
Projectile projectile = (Projectile)damager;
ProjectileSource source = projectile.getShooter();
if(evt.getEntity().getLastDamageCause().getEntity() instanceof Player) {
if(source instanceof Player) {
Player player = (Player) evt.getEntity().getLastDamageCause().getEntity();
Player player = (Player) source;
boolean okay = true;
if (plugin.citizens != null) {