Don't spawn an island if there isn't any room
This commit is contained in:
parent
4d01d75c39
commit
af5eb3c997
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user