From 7555571424d4493e7da53454f8778f21fdc9b420 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 6 Dec 2012 20:38:23 -0500 Subject: [PATCH] Correctly shoot arrows with the spawnArrow Method. Fixes BUKKIT-3116 By: Dark Arc --- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index f66aa0ed8..346b1833b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -304,10 +304,13 @@ public class CraftWorld implements World { } public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) { + Validate.notNull(loc, "Can not spawn arrow with a null location"); + Validate.notNull(velocity, "Can not spawn arrow with a null velocity"); + EntityArrow arrow = new EntityArrow(world); - arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), 0, 0); - world.addEntity(arrow); + arrow.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw()); arrow.shoot(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread); + world.addEntity(arrow); return (Arrow) arrow.getBukkitEntity(); }