This commit is contained in:
坏黑
2018-09-15 00:21:58 +08:00
parent dbf319addb
commit a9700dfdd3
8 changed files with 170 additions and 121 deletions

View File

@@ -4,19 +4,11 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@Deprecated
public class GetDamager {
public static Player get(EntityDamageByEntityEvent e) {
Player p = null;
if (e.getDamager() instanceof Projectile) {
Projectile arrow = (Projectile) e.getDamager();
if (arrow.getShooter() instanceof Player) {
p = (Player) arrow.getShooter();
}
} else if (e.getDamager() instanceof Player) {
p = (Player) e.getDamager();
}
return p;
return DamageUtils.getAttackerInDamageEvent(e);
}
}