From 19c9a350772ac79b3db08f8858c02424b4dbdfc4 Mon Sep 17 00:00:00 2001 From: mcmonkey Date: Mon, 4 Mar 2019 11:21:36 -0800 Subject: [PATCH] allow locations of format x,y,z,pitch,yaw (without world) --- .../aufdemrand/denizen/objects/dLocation.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java b/plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java index fc41658dfd..1fe0365483 100644 --- a/plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java +++ b/plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java @@ -234,10 +234,31 @@ else if (split.size() == 4) return null; } } + else if (split.size() == 5) + + // If 5 values, location with pitch/yaw (no world) + // x,y,z,pitch,yaw + { + try { + dLocation output = new dLocation(null, + Double.valueOf(split.get(0)), + Double.valueOf(split.get(1)), + Double.valueOf(split.get(2)), + Float.valueOf(split.get(3)), + Float.valueOf(split.get(4))); + return output; + } + catch (Exception e) { + if (context == null || context.debug) { + dB.log("Minor: valueOf dLocation returning null: " + string + "(internal exception:" + e.getMessage() + ")"); + } + return null; + } + } else if (split.size() == 6) // If 6 values, location with pitch/yaw - // x,y,z,yaw,pitch,world + // x,y,z,pitch,yaw,world { try { World world = Bukkit.getWorld(split.get(5)); @@ -328,8 +349,8 @@ public dLocation(World world, double x, double y, double z) { super(world, x, y, z); } - public dLocation(World world, double x, double y, double z, float yaw, float pitch) { - super(world, x, y, z, pitch, yaw); + public dLocation(World world, double x, double y, double z, float pitch, float yaw) { + super(world, x, y, z, yaw, pitch); }