diff --git a/MobArena.jar b/MobArena.jar index fba82a7..7b00cb0 100644 Binary files a/MobArena.jar and b/MobArena.jar differ diff --git a/src/com/garbagemule/MobArena/MASpawnThread.java b/src/com/garbagemule/MobArena/MASpawnThread.java index 23c6a64..f859df3 100644 --- a/src/com/garbagemule/MobArena/MASpawnThread.java +++ b/src/com/garbagemule/MobArena/MASpawnThread.java @@ -296,6 +296,14 @@ public class MASpawnThread implements Runnable { for (Player p : arena.livePlayers) { + if (!arena.world.equals(p.getWorld())) + { + System.out.println("[MobArena] MASpawnThread:291: Player '" + p.getName() + "' is not in the right world. Force leaving..."); + arena.playerLeave(p); + MAUtils.tellPlayer(p, "You warped out of the arena world."); + continue; + } + if (s.distanceSquared(p.getLocation()) > MIN_DISTANCE) continue; @@ -326,9 +334,16 @@ public class MASpawnThread implements Runnable * time a squared distance smaller than current is found. */ for (Player p : arena.livePlayers) { - dist = p.getLocation().distance(e.getLocation()); + if (!arena.world.equals(p.getWorld())) + { + System.out.println("[MobArena] MASpawnThread:326: Player '" + p.getName() + "' is not in the right world. Force leaving..."); + arena.playerLeave(p); + MAUtils.tellPlayer(p, "You warped out of the arena world."); + continue; + } + dist = p.getLocation().distanceSquared(e.getLocation()); //double dist = MAUtils.distance(p.getLocation(), e.getLocation()); - if (dist < current && dist < 256) + if (dist < current && dist < MIN_DISTANCE) { current = dist; result = p; diff --git a/src/com/garbagemule/MobArena/MAUtils.java b/src/com/garbagemule/MobArena/MAUtils.java index a349fa7..9312127 100644 --- a/src/com/garbagemule/MobArena/MAUtils.java +++ b/src/com/garbagemule/MobArena/MAUtils.java @@ -905,7 +905,15 @@ public class MAUtils * time a squared distance smaller than current is found. */ for (Player p : arena.livePlayers) { - double dist = p.getLocation().distanceSquared(e.getLocation()); //distance(p.getLocation(), e.getLocation()); + if (!arena.world.equals(p.getWorld())) + { + System.out.println("[MobArena] MAUtils:908: Player '" + p.getName() + "' is not in the right world. Force leaving..."); + arena.playerLeave(p); + tellPlayer(p, "You warped out of the arena world."); + continue; + } + + double dist = p.getLocation().distanceSquared(e.getLocation()); if (dist < current && dist < 256) { current = dist; @@ -915,14 +923,14 @@ public class MAUtils return result; } - public static double distance(Location loc1, Location loc2) + /*public static double distance(Location loc1, Location loc2) { double x = loc1.getX() - loc2.getX(); double y = loc1.getY() - loc2.getY(); double z = loc1.getZ() - loc2.getZ(); return x*x + y*y + z*z; - } + }*/ /** * Convert a proper arena name to a config-file name.