diff options
author | Minenash <minenash@protonmail.com> | 2019-01-05 00:59:43 -0500 |
---|---|---|
committer | Minenash <minenash@protonmail.com> | 2019-01-05 00:59:43 -0500 |
commit | 5d6e5d4264c911c7bccdf20a08b74e771dfd9cf5 (patch) | |
tree | 4f13a39d79a8c577727d03437b7258f7c65ce0ab | |
parent | dc4085e211701b213f23bb373b7769d7f91ad191 (diff) |
Fixed bug when your old location was also valid, then you couldn't move.
-rw-r--r-- | src/main/java/com/redstoner/modules/worldborder/WorldBorder.java | 7 | ||||
-rw-r--r-- | src/main/java/com/redstoner/modules/worldborder/WorldBorderInfo.java | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/com/redstoner/modules/worldborder/WorldBorder.java b/src/main/java/com/redstoner/modules/worldborder/WorldBorder.java index c8da4c3..b5a1deb 100644 --- a/src/main/java/com/redstoner/modules/worldborder/WorldBorder.java +++ b/src/main/java/com/redstoner/modules/worldborder/WorldBorder.java @@ -183,11 +183,14 @@ public class WorldBorder implements Module, Listener { if (info == null || info.isCordanateWithinBounds(to.getBlockX(), to.getBlockZ())) return to; else { - System.out.println(p.isInsideVehicle()); if (p.isInsideVehicle()) p.getVehicle().remove(); ChatAPI.sendActionBar(p, message); - return from; + + if (info.isCordanateWithinBounds(from.getBlockX(), from.getBlockZ())) + return from; + else + return new Location(to.getWorld(), info.getCX(), 80, info.getCZ()); } } } diff --git a/src/main/java/com/redstoner/modules/worldborder/WorldBorderInfo.java b/src/main/java/com/redstoner/modules/worldborder/WorldBorderInfo.java index 7ff4430..fa7502e 100644 --- a/src/main/java/com/redstoner/modules/worldborder/WorldBorderInfo.java +++ b/src/main/java/com/redstoner/modules/worldborder/WorldBorderInfo.java @@ -23,6 +23,14 @@ public class WorldBorderInfo { return x > minX && x < maxX && z > minZ && z < maxZ; } + public int getCX() { + return cx; + } + + public int getCZ() { + return cz; + } + public String getMessage() { return message; } @@ -41,6 +49,5 @@ public class WorldBorderInfo { public static WorldBorderInfo fromJSONObject(JSONObject j) { return new WorldBorderInfo(((Long)j.get("cx")).intValue(), ((Long)j.get("cz")).intValue(), ((Long)j.get("r")).intValue()); - } - + } } |