mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Fix for NPE with dispenser+arrow bug.
This commit is contained in:
parent
bdd3c4dabe
commit
eabdc7ffa9
1 changed files with 7 additions and 1 deletions
|
@ -176,7 +176,13 @@ public class EntityArrow extends Entity {
|
||||||
|
|
||||||
//TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
|
//TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
|
||||||
// or leave as DamageCause.ENTITY_ATTACK
|
// or leave as DamageCause.ENTITY_ATTACK
|
||||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(b.getBukkitEntity(), entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4);
|
org.bukkit.entity.Entity shooter = null;
|
||||||
|
if ((EntityLiving)b != null) {
|
||||||
|
shooter = new org.bukkit.craftbukkit.entity.CraftLivingEntity(server, b);
|
||||||
|
} else if ((Entity)b != null) {
|
||||||
|
shooter = (org.bukkit.entity.Entity) b.getBukkitEntity();
|
||||||
|
}
|
||||||
|
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4);
|
||||||
|
|
||||||
server.getPluginManager().callEvent(edbpe);
|
server.getPluginManager().callEvent(edbpe);
|
||||||
if(!edbpe.isCancelled()) {
|
if(!edbpe.isCancelled()) {
|
||||||
|
|
Loading…
Reference in a new issue