From dadc539211e12524801bf7141c349160d0a6aa7b Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 30 Apr 2019 21:31:08 +1000 Subject: [PATCH] World#spawnArrow should return an AbstractArrow now --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 4 ++-- src/main/java/org/bukkit/craftbukkit/util/Commodore.java | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 4e59a163d4..31263b5184 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -521,12 +521,12 @@ public class CraftWorld implements World { } @Override - public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) { + public AbstractArrow spawnArrow(Location loc, Vector velocity, float speed, float spread) { return spawnArrow(loc, velocity, speed, spread, Arrow.class); } @Override - public T spawnArrow(Location loc, Vector velocity, float speed, float spread, Class clazz) { + public T spawnArrow(Location loc, Vector velocity, float speed, float spread, Class clazz) { Validate.notNull(loc, "Can not spawn arrow with a null location"); Validate.notNull(velocity, "Can not spawn arrow with a null velocity"); Validate.notNull(clazz, "Can not spawn an arrow with no class"); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java index 467b2d9385..75aa474b8b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java @@ -235,6 +235,12 @@ 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 ) {