mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-28 10:21:27 +01:00
Added world-checks in Arena and MASpawnThread
This commit is contained in:
parent
8c157af7bc
commit
7fc43e45db
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -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;
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user