From 155fabb9e96b8a4ec87af58d6daed39c848e1ad5 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 30 Mar 2018 20:23:53 +0100 Subject: [PATCH] Reorder the logic of cake wars islands. --- .../games/cakewars/island/CakeIslandModule.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 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 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; } }