From c8b5c84aa68338ad382e548e4cf3f1ec2f060d0d Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Mon, 4 May 2015 00:42:49 -0500 Subject: [PATCH 1/2] Added Master Builder quick game menu option. Added player counts to quick game menu --- .../mineplex/hub/server/ServerManager.java | 21 +++++ .../hub/server/ui/ServerGameMenu.java | 85 ++++++++++++++++--- .../hub/server/ui/button/SelectBLDButton.java | 23 +++++ 3 files changed, 116 insertions(+), 13 deletions(-) create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBLDButton.java diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index a0c85fa2d..bf9cf43eb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -76,6 +76,7 @@ public class ServerManager extends MiniPlugin private NautHashMap> _serverKeyInfoMap = new NautHashMap>(); private NautHashMap _serverKeyTagMap = new NautHashMap(); + private NautHashMap _serverPlayerCounts = new NautHashMap(); private NautHashMap _serverNpcShopMap = new NautHashMap(); private NautHashMap _serverInfoMap = new NautHashMap(); private NautHashMap _serverUpdate = new NautHashMap(); @@ -411,6 +412,8 @@ public class ServerManager extends MiniPlugin { public void run(Collection serverStatusList) { + _serverPlayerCounts.clear(); + for (MinecraftServer serverStatus : serverStatusList) { if (!_serverInfoMap.containsKey(serverStatus.getName())) @@ -451,6 +454,11 @@ public class ServerManager extends MiniPlugin if (_serverKeyTagMap.containsKey(tag)) { _serverKeyInfoMap.get(_serverKeyTagMap.get(tag)).add(serverInfo); + + if (!_serverPlayerCounts.containsKey(tag)) + _serverPlayerCounts.put(tag, 0); + + _serverPlayerCounts.put(tag, _serverPlayerCounts.get(tag) + serverInfo.CurrentPlayers); } } @@ -749,4 +757,17 @@ public class ServerManager extends MiniPlugin { return _serverNpcShopMap.get("Wizards"); } + + public int getGroupTagPlayerCount(String tag) + { + if (_serverPlayerCounts.containsKey(tag)) + return _serverPlayerCounts.get(tag); + else + return 0; + } + + public ShopBase getBuildShop() + { + return _serverNpcShopMap.get("Build"); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 2cf8cb46b..332aa4985 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -15,6 +15,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerManager; import mineplex.hub.server.ui.button.SelectBHButton; +import mineplex.hub.server.ui.button.SelectBLDButton; import mineplex.hub.server.ui.button.SelectBRButton; import mineplex.hub.server.ui.button.SelectCSButton; import mineplex.hub.server.ui.button.SelectDMTButton; @@ -48,82 +49,110 @@ public class ServerGameMenu extends ShopPageBase @Override protected void buildPage() { - this.setItem(0, ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "The Bridges " + C.cGray + "4 Team Survival", new String[] + setItem(0, ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "The Bridges " + C.cGray + "4 Team Survival", new String[] { ChatColor.RESET + "", ChatColor.RESET + "4 Teams get 10 minutes to prepare.", ChatColor.RESET + "Then the bridges drop, and all hell", ChatColor.RESET + "breaks loose as you battle to the", ChatColor.RESET + "death with the other teams.", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BR") + ChatColor.RESET + " other players!", })); - this.setItem(2, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[] + setItem(2, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Search for chests to find loot and ", ChatColor.RESET + "fight others to be the last man standing. ", ChatColor.RESET + "Beware of the deep freeze!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("HG") + ChatColor.RESET + " other players!", })); - this.setItem(4, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Mine-Strike " + C.cGray + "Team Survival", new String[] + setItem(4, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Mine-Strike " + C.cGray + "Team Survival", new String[] { ChatColor.RESET + "", ChatColor.RESET + "One team must defend two bomb sites from", ChatColor.RESET + "the other team, who are trying to plant a bomb", ChatColor.RESET + "and blow them up!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MS") + ChatColor.RESET + " other players!", })); - this.setItem(6, _superSmashCycle.get(_ssmIndex)); + setItem(6, _superSmashCycle.get(_ssmIndex)); - this.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 + "Wield powerful spells to fight", ChatColor.RESET + "against other players in this", ChatColor.RESET + "exciting free-for-all brawl!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("WIZ") + ChatColor.RESET + " other players!", })); - this.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[] { ChatColor.RESET + "", ChatColor.RESET + "Players take turns at drawing a random", ChatColor.RESET + "word. Whoever guesses it within the time", ChatColor.RESET + "limit gets some points!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + ChatColor.RESET + " other players!", })); - this.setItem(20, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Castle Siege " + C.cGray + "Team Game", new String[] + setItem(20, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Castle Siege " + C.cGray + "Team Game", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Defenders must protect King Sparklez", ChatColor.RESET + "from the endless waves of Undead", ChatColor.RESET + "until the sun rises!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("CS") + ChatColor.RESET + " other players!", })); - this.setItem(22, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Dominate " + C.cGray + "Team Game", new String[] + setItem(22, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Dominate " + C.cGray + "Team Game", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Customize one of five exciting champions", ChatColor.RESET + "and battle with the opposing team for the", ChatColor.RESET + "control points on the map.", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DOM") + ChatColor.RESET + " other players!", })); - this.setItem(24, ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Team Deathmatch " + C.cGray + "Team Game", new String[] + setItem(24, ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Team Deathmatch " + C.cGray + "Team Game", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Customize one of five exciting champions", ChatColor.RESET + "and battle with the opposing team to the", ChatColor.RESET + "last man standing.", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TDM") + ChatColor.RESET + " other players!", })); - this.setItem(26, ItemStackFactory.Instance.CreateStack(Material.GRASS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[] + setItem(26, ItemStackFactory.Instance.CreateStack(Material.GRASS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Hide as blocks/animals, upgrade your ", ChatColor.RESET + "weapon and fight to survive against", ChatColor.RESET + "the Hunters!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BH") + ChatColor.RESET + " other players!", })); - this.setItem(40, _minigameCycle.get(_minigameIndex)); + 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[] + { + ChatColor.RESET + "", + ChatColor.RESET + "Players are given a Build Theme and ", + ChatColor.RESET + "must use blocks, monsters and more", + ChatColor.RESET + "to create a masterpiece!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + ChatColor.RESET + " other players!", + })); + + setItem(44, _minigameCycle.get(_minigameIndex)); getButtonMap().put(0, new SelectBRButton(this)); getButtonMap().put(2, new SelectSGButton(this)); @@ -136,7 +165,8 @@ public class ServerGameMenu extends ShopPageBase getButtonMap().put(22, new SelectDOMButton(this)); getButtonMap().put(24, new SelectTDMButton(this)); getButtonMap().put(26, new SelectBHButton(this)); - getButtonMap().put(40, new SelectMINButton(this)); + getButtonMap().put(36, new SelectBLDButton(this)); + getButtonMap().put(44, new SelectMINButton(this)); } @SuppressWarnings("deprecation") @@ -158,6 +188,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -175,7 +207,9 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", - ChatColor.RESET + "Bacon Brawl" + ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(122, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -194,6 +228,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -212,6 +248,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -230,6 +268,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.MILK_BUCKET.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -248,6 +288,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.MILK_BUCKET.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -266,6 +308,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -284,6 +328,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(159, (byte)14, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -302,6 +348,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + C.Bold + ChatColor.GREEN + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(309, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -320,6 +368,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Death Tag", ChatColor.RESET + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); _minigameCycle.add(ItemStackFactory.Instance.CreateStack(319, (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] @@ -338,6 +388,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Turf Wars", ChatColor.RESET + "Death Tag", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Bacon Brawl", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MIN") + ChatColor.RESET + " other players!", })); } @@ -349,6 +401,8 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Pick from a selection of monsters,", ChatColor.RESET + "then battle other players to the ", ChatColor.RESET + "death with your monsters skills!", + ChatColor.RESET + "", + ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SSM") + ChatColor.RESET + " other players!", }; _superSmashCycle.add(ItemStackFactory.Instance.CreateStack(397, (byte)4, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Super Smash Mobs", desc)); @@ -422,4 +476,9 @@ public class ServerGameMenu extends ShopPageBase { getPlugin().getWizardShop().attemptShopOpen(player); } + + public void OpenBLD(Player player) + { + getPlugin().getBuildShop().attemptShopOpen(player); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBLDButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBLDButton.java new file mode 100644 index 000000000..38fdf404c --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectBLDButton.java @@ -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 SelectBLDButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectBLDButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.OpenBLD(player); + } +} From 677c8d1198f9d0255ab1610f2d1c6060833ee8af Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Mon, 4 May 2015 00:42:59 -0500 Subject: [PATCH 2/2] Updated default MOTD. --- .../src/mineplex/bungee/motd/MotdManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 68680211a..c1e19b5f8 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -56,8 +56,8 @@ public class MotdManager implements Listener, Runnable // Add in default MOTD listing to database List lines = new ArrayList(); - lines.add(" §e§lNEW GAME §a§lWizards!"); - lines.add(" §d§lRank Sale §a§l40% Off"); + lines.add(" §d§lMaster Builders§f - §d§lWizards§f - §d§lGravity"); + //lines.add(" §d§lRank Sale §a§l40% Off"); updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);