summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityArrow.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-12-10 12:48:56 +1100
committermd_5 <git@md-5.net>2016-12-10 12:48:56 +1100
commit7e02867f09c3957574d1e421532bdbbd9f4fffc6 (patch)
tree1df4e7bcf285743724d5659ab021879c15b50c5c /nms-patches/EntityArrow.patch
parentaa257534dc4c21811653012c1f3f996df25e724a (diff)
downloadcraftbukkit-7e02867f09c3957574d1e421532bdbbd9f4fffc6.tar
craftbukkit-7e02867f09c3957574d1e421532bdbbd9f4fffc6.tar.gz
craftbukkit-7e02867f09c3957574d1e421532bdbbd9f4fffc6.tar.lz
craftbukkit-7e02867f09c3957574d1e421532bdbbd9f4fffc6.tar.xz
craftbukkit-7e02867f09c3957574d1e421532bdbbd9f4fffc6.zip
SPIGOT-2242: Handle changed item in PlayerPickupArrowEvent
Diffstat (limited to 'nms-patches/EntityArrow.patch')
-rw-r--r--nms-patches/EntityArrow.patch17
1 files changed, 10 insertions, 7 deletions
diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch
index 656ebe0a..8da69dc2 100644
--- a/nms-patches/EntityArrow.patch
+++ b/nms-patches/EntityArrow.patch
@@ -46,15 +46,14 @@
}
if (entity.damageEntity(damagesource, (float) i)) {
-@@ -422,6 +436,20 @@
+@@ -422,9 +436,22 @@
public void d(EntityHuman entityhuman) {
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
+ // CraftBukkit start
-+ ItemStack itemstack = new ItemStack(Items.ARROW);
++ ItemStack itemstack = this.j(); // PAIL: rename
++ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
+ if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
-+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
-+
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
+ this.world.getServer().getPluginManager().callEvent(event);
@@ -63,11 +62,15 @@
+ return;
+ }
+ }
-+ // CraftBukkit end
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
-@@ -493,7 +521,14 @@
+- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
++ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
++ // CraftBukkit end
+ flag = false;
+ }
+
+@@ -493,7 +520,14 @@
}
if (EnchantmentManager.a(Enchantments.ARROW_FIRE, entityliving) > 0) {