Fixed MPS/Event server guis so they open up like old.

Changed sticks to player heads in solo/team selection.
This commit is contained in:
Jonathan Williams 2015-08-03 00:53:06 -05:00
parent bfaa0e6849
commit c32074e733
5 changed files with 28 additions and 12 deletions

View File

@ -680,13 +680,12 @@ public class ServerManager extends MiniPlugin
{ {
for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null)) for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null))
{ {
addServerGroup(serverGroup); // Caches prefix/tag pairing
if (!serverGroup.getServerNpcName().isEmpty()) if (!serverGroup.getServerNpcName().isEmpty())
{ {
if (!HasServerNpc(serverGroup.getServerNpcName())) if (!HasServerNpc(serverGroup.getServerNpcName()))
{ {
AddServerNpc(serverGroup); AddServerNpc(serverGroup);
addServerGroup(serverGroup);
} }
} }
@ -721,8 +720,13 @@ public class ServerManager extends MiniPlugin
System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage()); System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage());
} }
AddServerNpc(new ServerGroup("Event Servers", "EVENT")); ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT");
AddServerNpc(new ServerGroup("Mineplex Player Servers", "MPS")); ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS");
AddServerNpc(eventGroup);
addServerGroup(eventGroup);
AddServerNpc(mpsGroup);
addServerGroup(mpsGroup);
} }
public int GetRequiredSlots(Player player, String serverType) public int GetRequiredSlots(Player player, String serverType)

View File

@ -52,6 +52,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
@Override @Override
protected void buildPage() 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[] 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", ChatColor.RESET + "Solo Mode",
@ -67,7 +68,9 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Click to play!" ChatColor.RESET + "Click to play!"
})); }));
*/
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().GetServerList(_serverNpcKey)); List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().GetServerList(_serverNpcKey));
int slotsNeeded = 1; int slotsNeeded = 1;
if (serverList.size() > 0) if (serverList.size() > 0)

View File

@ -26,10 +26,18 @@ public class ServerNpcShop extends ShopBase<ServerManager>
@Override @Override
protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player) protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player)
{
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); return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup);
} }
}
@Override @Override
protected boolean canOpenShop(Player player) protected boolean canOpenShop(Player player)
{ {
@ -74,7 +82,7 @@ public class ServerNpcShop extends ShopBase<ServerManager>
@Override @Override
public boolean attemptShopOpen(Player player) 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()); getPlugin().selectServer(player, getName());
return false; return false;

View File

@ -37,7 +37,7 @@ public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager,
Player player, ServerGroup serverGroup) Player player, ServerGroup serverGroup)
{ {
super(plugin, shop, clientManager, donationManager, serverGroup.getName(), player, 27); super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27);
_serverGroup = serverGroup; _serverGroup = serverGroup;
@ -49,7 +49,7 @@ public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
{ {
String name = _serverGroup.getName(); 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 + "Solo Mode",
ChatColor.RESET + "", ChatColor.RESET + "",
@ -58,7 +58,7 @@ public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
ChatColor.RESET + "Teaming in Solo Mode is bannable!", 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 + "Team Mode",
ChatColor.RESET + "", ChatColor.RESET + "",

View File

@ -165,10 +165,11 @@ public class ServerGroup
_npcName = npcName; _npcName = npcName;
} }
public ServerGroup(String prefix, String npcName) public ServerGroup(String name, String npcName, String prefix)
{ {
_prefix = prefix; _name = name;
_npcName = npcName; _npcName = npcName;
_prefix = prefix;
} }
public String getName() { return _name; } public String getName() { return _name; }