mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Fixes #199
This commit is contained in:
parent
81806a06f4
commit
2e06140e80
@ -163,9 +163,9 @@ public class Set extends SubCommand {
|
||||
final Location base = MainUtil.getPlotBottomLoc(world, plot.id);
|
||||
base.setY(0);
|
||||
final Location relative = plr.getLocation().subtract(base.getX(), base.getY(), base.getZ());
|
||||
final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ());
|
||||
final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ(), relative.getY(), relative.getPitch());
|
||||
plot.settings.setPosition(blockloc);
|
||||
DBFunc.setPosition(loc.getWorld(), plot, relative.getX() + "," + relative.getY() + "," + relative.getZ());
|
||||
DBFunc.setPosition(loc.getWorld(), plot, blockloc.toString());
|
||||
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("alias")) {
|
||||
|
@ -913,9 +913,7 @@ public class SQLManager implements AbstractDB {
|
||||
break;
|
||||
default:
|
||||
try {
|
||||
final String[] split = pos.split(",");
|
||||
final BlockLoc loc = new BlockLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]));
|
||||
plot.settings.setPosition(loc);
|
||||
plot.settings.setPosition(BlockLoc.fromString(pos));
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,19 @@ public class BlockLoc {
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public BlockLoc(final int x, final int y, final int z) {
|
||||
public float yaw, pitch;
|
||||
|
||||
public BlockLoc(final int x, final int y, final int z, final float yaw, final float pitch) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public BlockLoc(final int x, final int y, final int z) {
|
||||
this(x, y, z, 0f, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -35,4 +44,30 @@ public class BlockLoc {
|
||||
final BlockLoc other = (BlockLoc) obj;
|
||||
return ((this.x == other.x) && (this.y == other.y) && (this.z == other.z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return
|
||||
x + "," + y + "," + z + "," + yaw + "," + pitch;
|
||||
}
|
||||
|
||||
public static BlockLoc fromString(final String string) {
|
||||
String[] parts = string.split(",");
|
||||
|
||||
float yaw, pitch;
|
||||
if (parts.length == 3) {
|
||||
yaw = 0f;
|
||||
pitch = 0f;
|
||||
} if (parts.length == 5) {
|
||||
yaw = Float.parseFloat(parts[3]);
|
||||
pitch = Float.parseFloat(parts[4]);
|
||||
} else {
|
||||
return new BlockLoc(0, 0, 0);
|
||||
}
|
||||
int x = Integer.parseInt(parts[0]);
|
||||
int y = Integer.parseInt(parts[1]);
|
||||
int z = Integer.parseInt(parts[2]);
|
||||
|
||||
return new BlockLoc(x, y, z, yaw, pitch);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user