From af5eb3c997bff209e577769445d2720588b89451 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 1 Mar 2018 13:47:52 +0000 Subject: [PATCH] Don't spawn an island if there isn't any room --- .../game/games/cakewars/island/CakeIslandModule.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/island/CakeIslandModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/island/CakeIslandModule.java index 3f69d4f85..b76297e7a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/island/CakeIslandModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/island/CakeIslandModule.java @@ -245,8 +245,9 @@ public class CakeIslandModule extends CakeModule List 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; }