Players that warp out of the world will get kicked.
This commit is contained in:
Binary file not shown.
@@ -24,15 +24,13 @@ public class WaveUtils
|
|||||||
*/
|
*/
|
||||||
public static List<Location> getValidSpawnpoints(Arena arena, Collection<Player> players)
|
public static List<Location> getValidSpawnpoints(Arena arena, Collection<Player> players)
|
||||||
{
|
{
|
||||||
//long start = System.nanoTime();
|
|
||||||
List<Location> result = new ArrayList<Location>();
|
List<Location> result = new ArrayList<Location>();
|
||||||
|
|
||||||
//double x1 = Double.NaN, y1 = Double.NaN, z1 = Double.NaN, // Bottom
|
|
||||||
// x2 = Double.NaN, y2 = Double.NaN, z2 = Double.NaN; // Top
|
|
||||||
|
|
||||||
for (Location l : arena.getSpawnpoints())
|
for (Location l : arena.getSpawnpoints())
|
||||||
{
|
{
|
||||||
for (Player p : players)
|
for (Player p : players)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (l.distanceSquared(p.getLocation()) >= MobArena.MIN_PLAYER_DISTANCE_SQUARED)
|
if (l.distanceSquared(p.getLocation()) >= MobArena.MIN_PLAYER_DISTANCE_SQUARED)
|
||||||
continue;
|
continue;
|
||||||
@@ -40,44 +38,14 @@ public class WaveUtils
|
|||||||
result.add(l);
|
result.add(l);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
/*
|
|
||||||
// Get the region that the players span.
|
|
||||||
for (Player p : players)
|
|
||||||
{
|
{
|
||||||
double x = p.getLocation().getBlockX();
|
p.kickPlayer("Banned for life! No, but stop trying to cheat in MobArena!");
|
||||||
double y = p.getLocation().getBlockY();
|
MobArena.warning(p.getName() + " tried to cheat in MobArena and has been kicked.");
|
||||||
double z = p.getLocation().getBlockZ();
|
}
|
||||||
|
}
|
||||||
// Initialize the coordinates if they aren't already.
|
|
||||||
if (Double.isNaN(x1))
|
|
||||||
{
|
|
||||||
x1 = x; y1 = y; z1 = z; // Bottom
|
|
||||||
x2 = x; y2 = y; z2 = z; // Top
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update x
|
|
||||||
if (x < x1) x1 = x;
|
|
||||||
else if (x > x2) x2 = x;
|
|
||||||
|
|
||||||
// Update y
|
|
||||||
if (y < y1) y1 = y;
|
|
||||||
else if (y > y2) y2 = y;
|
|
||||||
|
|
||||||
// Update z
|
|
||||||
if (z < z1) z1 = z;
|
|
||||||
else if (z > z2) z2 = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expand by the minimum player distance.
|
|
||||||
x1 -= MobArena.MIN_PLAYER_DISTANCE; y1 -= MobArena.MIN_PLAYER_DISTANCE; z1 -= MobArena.MIN_PLAYER_DISTANCE;
|
|
||||||
x2 += MobArena.MIN_PLAYER_DISTANCE; y2 += MobArena.MIN_PLAYER_DISTANCE; z2 += MobArena.MIN_PLAYER_DISTANCE;
|
|
||||||
|
|
||||||
for (Location s : arena.getAllSpawnpoints())
|
|
||||||
if (MAUtils.inRegion(s, x1, y1, z1, x2, y2, z2))
|
|
||||||
result.add(s);
|
|
||||||
*/
|
|
||||||
// If no players are in range, just use all the spawnpoints.
|
// If no players are in range, just use all the spawnpoints.
|
||||||
if (result.isEmpty())
|
if (result.isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ public class Totals
|
|||||||
{
|
{
|
||||||
if (!ap.className.equals(className))
|
if (!ap.className.equals(className))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
kills += ap.kills;
|
kills += ap.kills;
|
||||||
dmgDone += ap.dmgDone;
|
dmgDone += ap.dmgDone;
|
||||||
dmgTaken += ap.dmgTaken;
|
dmgTaken += ap.dmgTaken;
|
||||||
|
|||||||
Reference in New Issue
Block a user