Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
Mini-Chiss 2015-05-04 00:56:19 -05:00
commit 0d1de153ec
4 changed files with 118 additions and 15 deletions

View File

@ -56,8 +56,8 @@ public class MotdManager implements Listener, Runnable
// Add in default MOTD listing to database
List<String> lines = new ArrayList<String>();
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);

View File

@ -76,6 +76,7 @@ public class ServerManager extends MiniPlugin
private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>();
private NautHashMap<String, String> _serverKeyTagMap = new NautHashMap<String, String>();
private NautHashMap<String, Integer> _serverPlayerCounts = new NautHashMap<String, Integer>();
private NautHashMap<String, ServerNpcShop> _serverNpcShopMap = new NautHashMap<String, ServerNpcShop>();
private NautHashMap<String, ServerInfo> _serverInfoMap = new NautHashMap<String, ServerInfo>();
private NautHashMap<String, Long> _serverUpdate = new NautHashMap<String, Long>();
@ -411,6 +412,8 @@ public class ServerManager extends MiniPlugin
{
public void run(Collection<MinecraftServer> 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<ServerManager> getBuildShop()
{
return _serverNpcShopMap.get("Build");
}
}

View File

@ -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<ServerManager, QuickShop>
@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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
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<ServerManager, QuickShop>
{
getPlugin().getWizardShop().attemptShopOpen(player);
}
public void OpenBLD(Player player)
{
getPlugin().getBuildShop().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 SelectBLDButton implements IButton
{
private ServerGameMenu _menu;
public SelectBLDButton(ServerGameMenu menu)
{
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_menu.OpenBLD(player);
}
}