diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/page/SpectatorPage.java index a37c7b4d3..591136d3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/page/SpectatorPage.java @@ -44,10 +44,37 @@ public class SpectatorPage extends ShopPageBase @Override protected void BuildPage() { - int currentRow = 0; int playerCount = _arcadeManager.GetGame().GetPlayers(true).size(); List teamList = _arcadeManager.GetGame().GetTeamList(); + if (teamList.size() == 1 && playerCount < 28) + buildSingleTeam(teamList.get(0), playerCount); + else + buildMultipleTeams(teamList, playerCount); + + } + + private void buildSingleTeam(GameTeam team, int playerCount) + { + setItem(13, getTeamItem(team, playerCount)); + + int slot = 19; + + for (Player other : team.GetPlayers(true)) + { + addPlayerItem(slot, team, other); + + if ((slot + 2) % 9 == 0) + slot += 3; + else + slot++; + } + } + + private void buildMultipleTeams(List teamList, int playerCount) + { + int currentRow = 0; + for (GameTeam team : teamList) { ArrayList teamPlayers = team.GetPlayers(true); @@ -74,9 +101,7 @@ public class SpectatorPage extends ShopPageBase if (slot >= getSize()) continue; - ItemStack playerItem = getPlayerItem(team, teamPlayers.get(playerIndex)); - ShopItem shopItem = new ShopItem(playerItem, other.getName(), other.getName(), 1, false, false); - AddButton(slot, shopItem, new SpectatorButton(_arcadeManager, Player, other)); + addPlayerItem(slot, team, other); } } @@ -88,6 +113,13 @@ public class SpectatorPage extends ShopPageBase } } + private void addPlayerItem(int slot, GameTeam team, Player other) + { + ItemStack playerItem = getPlayerItem(team, other); + ShopItem shopItem = new ShopItem(playerItem, other.getName(), other.getName(), 1, false, false); + AddButton(slot, shopItem, new SpectatorButton(_arcadeManager, Player, other)); + } + private ItemStack getTeamItem(GameTeam team, int playerCount) { ItemStack item = new ItemStack(Material.WOOL, 1, (short)0, UtilColor.chatColorToWoolData(team.GetColor()));