SPIGOT-1956: Don't deplete projectile item when event cancelled

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2016-03-19 11:13:15 +11:00
parent 36f29a30b6
commit 865281201b
2 changed files with 40 additions and 2 deletions

View File

@@ -30,13 +30,18 @@
}
itemstack.damage(1, entityhuman);
@@ -81,7 +96,10 @@
@@ -81,7 +96,15 @@
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
- world.addEntity(entityarrow);
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ world.addEntity(entityarrow);
+ if (!world.addEntity(entityarrow)) {
+ if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return;
+ }
+ }
+ // CraftBukkit end
}