Add Beta Games and Player Servers to Quick game menu (text probably needs tweaking)

This commit is contained in:
Shaun Bennett 2015-05-10 16:58:04 -05:00
parent ef86f8bb6f
commit 800ce68637
4 changed files with 103 additions and 15 deletions

View File

@ -413,7 +413,7 @@ public class ServerManager extends MiniPlugin
public void run(Collection<MinecraftServer> serverStatusList) public void run(Collection<MinecraftServer> serverStatusList)
{ {
_serverPlayerCounts.clear(); _serverPlayerCounts.clear();
for (MinecraftServer serverStatus : serverStatusList) for (MinecraftServer serverStatus : serverStatusList)
{ {
if (!_serverInfoMap.containsKey(serverStatus.getName())) if (!_serverInfoMap.containsKey(serverStatus.getName()))
@ -454,10 +454,10 @@ public class ServerManager extends MiniPlugin
if (_serverKeyTagMap.containsKey(tag)) if (_serverKeyTagMap.containsKey(tag))
{ {
_serverKeyInfoMap.get(_serverKeyTagMap.get(tag)).add(serverInfo); _serverKeyInfoMap.get(_serverKeyTagMap.get(tag)).add(serverInfo);
if (!_serverPlayerCounts.containsKey(tag)) if (!_serverPlayerCounts.containsKey(tag))
_serverPlayerCounts.put(tag, 0); _serverPlayerCounts.put(tag, 0);
_serverPlayerCounts.put(tag, _serverPlayerCounts.get(tag) + serverInfo.CurrentPlayers); _serverPlayerCounts.put(tag, _serverPlayerCounts.get(tag) + serverInfo.CurrentPlayers);
} }
} }
@ -709,6 +709,16 @@ public class ServerManager extends MiniPlugin
{ {
return _serverNpcShopMap.get("Block Hunt"); return _serverNpcShopMap.get("Block Hunt");
} }
public ServerNpcShop getBetaShop()
{
return _serverNpcShopMap.get("Beta Games");
}
public ServerNpcShop getPlayerGamesShop()
{
return _serverNpcShopMap.get("Mineplex Player Servers");
}
private Vector ParseVector(String vectorString) private Vector ParseVector(String vectorString)
{ {

View File

@ -14,6 +14,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.button.SelectBETAButton;
import mineplex.hub.server.ui.button.SelectBHButton; import mineplex.hub.server.ui.button.SelectBHButton;
import mineplex.hub.server.ui.button.SelectBLDButton; import mineplex.hub.server.ui.button.SelectBLDButton;
import mineplex.hub.server.ui.button.SelectBRButton; import mineplex.hub.server.ui.button.SelectBRButton;
@ -22,6 +23,7 @@ import mineplex.hub.server.ui.button.SelectDMTButton;
import mineplex.hub.server.ui.button.SelectDOMButton; import mineplex.hub.server.ui.button.SelectDOMButton;
import mineplex.hub.server.ui.button.SelectMINButton; import mineplex.hub.server.ui.button.SelectMINButton;
import mineplex.hub.server.ui.button.SelectMSButton; import mineplex.hub.server.ui.button.SelectMSButton;
import mineplex.hub.server.ui.button.SelectPLAYERButton;
import mineplex.hub.server.ui.button.SelectSGButton; import mineplex.hub.server.ui.button.SelectSGButton;
import mineplex.hub.server.ui.button.SelectSSMButton; import mineplex.hub.server.ui.button.SelectSSMButton;
import mineplex.hub.server.ui.button.SelectTDMButton; import mineplex.hub.server.ui.button.SelectTDMButton;
@ -82,14 +84,14 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
setItem(6, _superSmashCycle.get(_ssmIndex)); setItem(6, _superSmashCycle.get(_ssmIndex));
setItem(8, ItemStackFactory.Instance.CreateStack(Material.BLAZE_ROD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Wizards " + C.cGray + "Last Man Standing", new String[] setItem(8, ItemStackFactory.Instance.CreateStack(Material.BLAZE_ROD.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Wizards " + C.cGray + "Last Man Standing", new String[]
{ {
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Wield powerful spells to fight", ChatColor.RESET + "Wield powerful spells to fight",
ChatColor.RESET + "against other players in this", ChatColor.RESET + "against other players in this",
ChatColor.RESET + "exciting free-for-all brawl!", ChatColor.RESET + "exciting free-for-all brawl!",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("WIZ") + ChatColor.RESET + " other players!", ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("WIZ") + ChatColor.RESET + " other players!",
})); }));
setItem(18, ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Draw My Thing " + C.cGray + "Pictionary!", new String[] setItem(18, ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Draw My Thing " + C.cGray + "Pictionary!", new String[]
@ -142,7 +144,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BH") + ChatColor.RESET + " other players!", ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BH") + ChatColor.RESET + " other players!",
})); }));
setItem(36, ItemStackFactory.Instance.CreateStack(Material.WOOD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Master Builders " + C.cGray + "Creative Build", new String[] setItem(37, ItemStackFactory.Instance.CreateStack(Material.WOOD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Master Builders " + C.cGray + "Creative Build", new String[]
{ {
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Players are given a Build Theme and ", ChatColor.RESET + "Players are given a Build Theme and ",
@ -152,7 +154,25 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + ChatColor.RESET + " other players!", ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + ChatColor.RESET + " other players!",
})); }));
setItem(44, _minigameCycle.get(_minigameIndex)); setItem(39, _minigameCycle.get(_minigameIndex));
setItem(41, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Player Servers " + C.cGray + "Player Hosted Games", new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "Join your friends in their own ",
ChatColor.RESET + "Mineplex Player Server. You can play",
ChatColor.RESET + "the games you want, when you want.",
ChatColor.RESET + "",
}));
setItem(43, ItemStackFactory.Instance.CreateStack(Material.ANVIL.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Beta Games " + C.cGray + "Play Unreleased Games", new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "Help test and improve our ",
ChatColor.RESET + "unreleased games.",
ChatColor.RESET + "",
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BETA") + ChatColor.RESET + " other players!",
}));
getButtonMap().put(0, new SelectBRButton(this)); getButtonMap().put(0, new SelectBRButton(this));
getButtonMap().put(2, new SelectSGButton(this)); getButtonMap().put(2, new SelectSGButton(this));
@ -165,8 +185,10 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
getButtonMap().put(22, new SelectDOMButton(this)); getButtonMap().put(22, new SelectDOMButton(this));
getButtonMap().put(24, new SelectTDMButton(this)); getButtonMap().put(24, new SelectTDMButton(this));
getButtonMap().put(26, new SelectBHButton(this)); getButtonMap().put(26, new SelectBHButton(this));
getButtonMap().put(36, new SelectBLDButton(this)); getButtonMap().put(37, new SelectBLDButton(this));
getButtonMap().put(44, new SelectMINButton(this)); getButtonMap().put(39, new SelectMINButton(this));
getButtonMap().put(41, new SelectPLAYERButton(this));
getButtonMap().put(43, new SelectBETAButton(this));
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -493,4 +515,14 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
{ {
getPlugin().getBuildShop().attemptShopOpen(player); getPlugin().getBuildShop().attemptShopOpen(player);
} }
public void openBeta(Player player)
{
getPlugin().getBetaShop().attemptShopOpen(player);
}
public void openPlayerGames(Player player)
{
getPlugin().getPlayerGamesShop().attemptShopOpen(player);
}
} }

View File

@ -0,0 +1,23 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectBETAButton implements IButton
{
private ServerGameMenu _menu;
public SelectBETAButton(ServerGameMenu menu)
{
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_menu.openBeta(player);
}
}

View File

@ -0,0 +1,23 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectPLAYERButton implements IButton
{
private ServerGameMenu _menu;
public SelectPLAYERButton(ServerGameMenu menu)
{
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_menu.openPlayerGames(player);
}
}