Skip to content

Commit

Permalink
allow locations of format x,y,z,pitch,yaw (without world)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 4, 2019
1 parent 1ef8096 commit 19c9a35
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}


Expand Down

0 comments on commit 19c9a35

Please sign in to comment.