diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java new file mode 100644 index 000000000..1dbc380a9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.gui.privateServer.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.gui.privateServer.PrivateServerShop; + +/** + * Created by WilliamTiger. + * All the code and any API's associated with it + * are not to be used anywhere else without written + * consent of William Burns. 2015. + * 08/07/2015 + */ +public class ChooseMapButton implements IButton +{ + private ArcadeManager _arcadeManager; + private PrivateServerShop _privateServerShop; + private GameType _gameType; + private String _map; + + public ChooseMapButton(ArcadeManager arcadeManager, PrivateServerShop privateServerShop, GameType gameType, String map) + { + _arcadeManager = arcadeManager; + _privateServerShop = privateServerShop; + _gameType = gameType; + _map = map; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _arcadeManager.GetGameCreationManager().MapPref = _map; + _arcadeManager.GetGame().setGame(_gameType, player, true); + player.closeInventory(); + return; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java new file mode 100644 index 000000000..d1c062387 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.gui.privateServer.page; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.shop.item.ShopItem; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.gui.privateServer.PrivateServerShop; +import nautilus.game.arcade.gui.privateServer.button.ChooseMapButton; + +/** + * Created by WilliamTiger. + * All the code and any API's associated with it + * are not to be used anywhere else without written + * consent of William Burns. 2015. + * 08/07/2015 + */ +public class ChooseMapPage extends BasePage +{ + private GameType _gameType; + + public ChooseMapPage(ArcadeManager plugin, PrivateServerShop shop, Player player, GameType gameType) + { + super(plugin, shop, "Choose Map", player); + _gameType = gameType; + + buildPage(); + } + + @Override + protected void buildPage() + { + addBackButton(4); + + int slot = 0; + for (String cur : getPlugin().LoadFiles(_gameType.GetName())){ + ChooseMapButton btn = new ChooseMapButton(getPlugin(), getShop(), _gameType, cur); + addButton(slot, new ShopItem(Material.MAP, "cur", new String[]{"§7Click to select map."}, 1, false), btn); + slot++; + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java index b8ca9a28e..5f41f6a13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java @@ -62,15 +62,28 @@ public class SetGamePage extends BasePage private void addGameButton(int slot, final GameType type) { - String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type"; - ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false); + String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type"; + String space = ""; + String left = ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §drandom map§7."; + String right = ChatColor.YELLOW + "Right-Click " + C.cGray + "to §6choose map§7."; + ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString, space, left, right}, 1, false, false); addButton(slot, shopItem, new IButton() { @Override public void onClick(Player player, ClickType clickType) { - getPlugin().GetGame().setGame(type, player, true); - player.closeInventory(); + if (clickType == ClickType.LEFT) + { + getPlugin().GetGame().setGame(type, player, true); + player.closeInventory(); + return; + } + else if (clickType == ClickType.RIGHT) + { + getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type)); + return; + } + } }); }