Added map selection to MPS.
This commit is contained in:
parent
0bf9628195
commit
6008e58c12
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -62,15 +62,28 @@ public class SetGamePage extends BasePage
|
|||||||
|
|
||||||
private void addGameButton(int slot, final GameType type)
|
private void addGameButton(int slot, final GameType type)
|
||||||
{
|
{
|
||||||
String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type";
|
String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
|
||||||
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false);
|
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()
|
addButton(slot, shopItem, new IButton()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
getPlugin().GetGame().setGame(type, player, true);
|
if (clickType == ClickType.LEFT)
|
||||||
player.closeInventory();
|
{
|
||||||
|
getPlugin().GetGame().setGame(type, player, true);
|
||||||
|
player.closeInventory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (clickType == ClickType.RIGHT)
|
||||||
|
{
|
||||||
|
getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user