From 6008e58c12318fe26e389781d20d60fa465ea79c Mon Sep 17 00:00:00 2001 From: William Burns Date: Wed, 8 Jul 2015 09:49:41 +0100 Subject: [PATCH 001/113] Added map selection to MPS. --- .../privateServer/button/ChooseMapButton.java | 41 ++++++++++++++++++ .../gui/privateServer/page/ChooseMapPage.java | 43 +++++++++++++++++++ .../gui/privateServer/page/SetGamePage.java | 21 +++++++-- 3 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/ChooseMapPage.java 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; + } + } }); } From 3ba7ba259cc620a5f7968492bd72e13f44bf5cef Mon Sep 17 00:00:00 2001 From: William Burns Date: Wed, 8 Jul 2015 15:24:16 +0100 Subject: [PATCH 002/113] Added map selection to MPS. --- Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml | 2 ++ Plugins/.idea/codeStyleSettings.xml | 1 + .../game/arcade/gui/privateServer/page/ChooseMapPage.java | 4 ++-- .../game/arcade/gui/privateServer/page/SetGamePage.java | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml index 3f5cae6e4..2fb39df09 100644 --- a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml +++ b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml @@ -18,6 +18,8 @@ + + \ No newline at end of file diff --git a/Plugins/.idea/codeStyleSettings.xml b/Plugins/.idea/codeStyleSettings.xml index 8e890f86b..44295e3d8 100644 --- a/Plugins/.idea/codeStyleSettings.xml +++ b/Plugins/.idea/codeStyleSettings.xml @@ -37,6 +37,7 @@ + +