From c32074e7330f5fd9a80046aa37d8a8939edb12a8 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Mon, 3 Aug 2015 00:53:06 -0500 Subject: [PATCH] Fixed MPS/Event server guis so they open up like old. Changed sticks to player heads in solo/team selection. --- .../src/mineplex/hub/server/ServerManager.java | 12 ++++++++---- .../src/mineplex/hub/server/ui/ServerNpcPage.java | 3 +++ .../src/mineplex/hub/server/ui/ServerNpcShop.java | 12 ++++++++++-- .../src/mineplex/hub/server/ui/ServerTypePage.java | 6 +++--- .../src/mineplex/serverdata/data/ServerGroup.java | 7 ++++--- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 0fcb70223..909827f6e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -680,13 +680,12 @@ public class ServerManager extends MiniPlugin { for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null)) { - addServerGroup(serverGroup); // Caches prefix/tag pairing - if (!serverGroup.getServerNpcName().isEmpty()) { if (!HasServerNpc(serverGroup.getServerNpcName())) { AddServerNpc(serverGroup); + addServerGroup(serverGroup); } } @@ -721,8 +720,13 @@ public class ServerManager extends MiniPlugin System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage()); } - AddServerNpc(new ServerGroup("Event Servers", "EVENT")); - AddServerNpc(new ServerGroup("Mineplex Player Servers", "MPS")); + ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT"); + ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS"); + + AddServerNpc(eventGroup); + addServerGroup(eventGroup); + AddServerNpc(mpsGroup); + addServerGroup(mpsGroup); } public int GetRequiredSlots(Player player, String serverType) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 298752e55..d484f1cbc 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -52,6 +52,7 @@ public class ServerNpcPage extends ShopPageBase im @Override protected void buildPage() { + /* setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Solo " + C.cGray + getName(), new String[] { ChatColor.RESET + "Solo Mode", @@ -67,7 +68,9 @@ public class ServerNpcPage extends ShopPageBase im ChatColor.RESET + "", ChatColor.RESET + "Click to play!" })); + */ List serverList = new ArrayList(getPlugin().GetServerList(_serverNpcKey)); + int slotsNeeded = 1; if (serverList.size() > 0) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java index ba4f5bf4a..2dd75eaad 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcShop.java @@ -27,7 +27,15 @@ public class ServerNpcShop extends ShopBase @Override protected ShopPageBase> buildPagesFor(Player player) { - return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); + if (_serverGroup.getPrefix().equalsIgnoreCase("MPS") || _serverGroup.getPrefix().equalsIgnoreCase("EVENT")) + { + return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()); + } + else + { + return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup); + } + } @Override @@ -74,7 +82,7 @@ public class ServerNpcShop extends ShopBase @Override public boolean attemptShopOpen(Player player) { - if (_serverGroup.getTeamServerKey().isEmpty()) // Has no team server key, so auto-join + if (_serverGroup.getTeamServerKey().isEmpty() && !_serverGroup.getPrefix().equalsIgnoreCase("EVENT") && !_serverGroup.getPrefix().equalsIgnoreCase("MPS")) // Has no team server key, so auto-join { getPlugin().selectServer(player, getName()); return false; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java index 2b9b4c378..434e1c9f8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerTypePage.java @@ -37,7 +37,7 @@ public class ServerTypePage extends ShopPageBase public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, ServerGroup serverGroup) { - super(plugin, shop, clientManager, donationManager, serverGroup.getName(), player, 27); + super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27); _serverGroup = serverGroup; @@ -49,7 +49,7 @@ public class ServerTypePage extends ShopPageBase { String name = _serverGroup.getName(); - setItem(12, ItemStackFactory.Instance.CreateStack(Material.STICK.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Solo " + C.cGray + name, new String[] + setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Solo " + C.cGray + name, new String[] { ChatColor.RESET + "Solo Mode", ChatColor.RESET + "", @@ -58,7 +58,7 @@ public class ServerTypePage extends ShopPageBase ChatColor.RESET + "Teaming in Solo Mode is bannable!", })); - setItem(14, ItemStackFactory.Instance.CreateStack(Material.STICK.getId(), (byte)0, 2, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Team " + C.cGray + name, new String[] + setItem(14, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 2, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Team " + C.cGray + name, new String[] { ChatColor.RESET + "Team Mode", ChatColor.RESET + "", diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index 9f8313fed..0aa8a16e7 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java @@ -165,10 +165,11 @@ public class ServerGroup _npcName = npcName; } - public ServerGroup(String prefix, String npcName) - { - _prefix = prefix; + public ServerGroup(String name, String npcName, String prefix) + { + _name = name; _npcName = npcName; + _prefix = prefix; } public String getName() { return _name; }