Don't spawn an island if there isn't any room

This commit is contained in:
Sam 2018-03-01 13:47:52 +00:00 committed by Alexander Meech
parent 4d01d75c39
commit af5eb3c997

View File

@ -245,8 +245,9 @@ public class CakeIslandModule extends CakeModule
List<Player> alive = _game.GetPlayers(true);
attemptsLoop:
while (location == null || attempts++ < MAX_ATTEMPTS)
while (location == null)
{
attempts++;
location = UtilAlg.getRandomLocation(_center, MAX_XZ, 0, MAX_XZ);
Chunk chunk = location.getChunk();
@ -260,7 +261,6 @@ public class CakeIslandModule extends CakeModule
}
// Prevent islands spawning in the same chunk as the player
// This prevents the invisibility bug
for (Player player : alive)
{
if (player.getLocation().getChunk().equals(chunk))
@ -269,6 +269,11 @@ public class CakeIslandModule extends CakeModule
}
}
if (attempts >= MAX_ATTEMPTS)
{
return null;
}
break;
}