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 b76297e7a..01b15e9f9 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 @@ -240,15 +240,14 @@ public class CakeIslandModule extends CakeModule private Location getRandomLocation() { - Location location = null; int attempts = 0; List alive = _game.GetPlayers(true); attemptsLoop: - while (location == null) + while (attempts < MAX_ATTEMPTS) { attempts++; - location = UtilAlg.getRandomLocation(_center, MAX_XZ, 0, MAX_XZ); + Location location = UtilAlg.getRandomLocation(_center, MAX_XZ, 0, MAX_XZ); Chunk chunk = location.getChunk(); // Prevent islands spawning inside other blocks @@ -269,15 +268,10 @@ public class CakeIslandModule extends CakeModule } } - if (attempts >= MAX_ATTEMPTS) - { - return null; - } - - break; + return location; } - return location; + return null; } }