From bbd66d20468338b6dea6c644472924d313d21227 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 1 May 2019 06:48:56 +1000 Subject: [PATCH] SPIGOT-4823: Crash picking up arrows --- nms-patches/EntityArrow.patch | 2 +- src/main/java/org/bukkit/craftbukkit/util/Commodore.java | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch index b7daf7cdb7..55ca3a6139 100644 --- a/nms-patches/EntityArrow.patch +++ b/nms-patches/EntityArrow.patch @@ -52,7 +52,7 @@ + ItemStack itemstack = this.getItemStack(); + if (this.fromPlayer == PickupStatus.ALLOWED && !itemstack.isEmpty() && 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()); ++ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity()); + // event.setCancelled(!entityhuman.canPickUpLoot); TODO + this.world.getServer().getPluginManager().callEvent(event); + diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java index 75aa474b8b..467b2d9385 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java @@ -235,12 +235,6 @@ public class Commodore super.visitMethodInsn( opcode, owner, name, "(I)Lorg/bukkit/map/MapView;", itf ); return; } - if ( owner.equals( "org/bukkit/World" ) && name.equals( "spawnArrow" ) ) - { - // Should be same size on stack so just call other method - super.visitMethodInsn( opcode, owner, name, desc.replace( "Lorg/bukkit/entity/Arrow;", "Lorg/bukkit/entity/AbstractArrow;" ), itf ); - return; - } if ( modern ) {