From 7e02867f09c3957574d1e421532bdbbd9f4fffc6 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 10 Dec 2016 12:48:56 +1100 Subject: SPIGOT-2242: Handle changed item in PlayerPickupArrowEvent --- nms-patches/EntityArrow.patch | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'nms-patches') 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) { -- cgit v1.2.3