Fixes for servers.

This commit is contained in:
Jonathan Williams 2015-08-03 05:55:33 -05:00
parent 6c0666c59b
commit 37b779f108
4 changed files with 6 additions and 27 deletions

View File

@ -589,9 +589,9 @@ public class ServerManager extends MiniPlugin
if (serverList == null) return null; if (serverList == null) return null;
List<ServerInfo> servers = new ArrayList<ServerInfo>(serverList); List<ServerInfo> servers = new ArrayList<ServerInfo>(serverList);
Collections.sort(servers, new ServerCountSorter());
servers = fetchOpenServers(player, servers, servers.size()); // Removes all full servers from list servers = fetchOpenServers(player, servers, servers.size()); // Removes all full servers from list
Collections.sort(servers, new ServerCountSorter());
int count = Math.min(servers.size(), TOP_SERVERS); int count = Math.min(servers.size(), TOP_SERVERS);
if (count > 0) if (count > 0)
@ -600,10 +600,12 @@ public class ServerManager extends MiniPlugin
if (largestServer.getAvailableSlots() >= MIN_SLOTS_REQUIRED || largestServer.MaxPlayers > 40) if (largestServer.getAvailableSlots() >= MIN_SLOTS_REQUIRED || largestServer.MaxPlayers > 40)
{ {
System.out.println("Largest.");
return largestServer; return largestServer;
} }
else else
{ {
System.out.println("Random.");
return servers.get(random.nextInt(count)); return servers.get(random.nextInt(count));
} }
} }
@ -689,13 +691,9 @@ 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); addServerGroup(serverGroup);
System.out.println("Adding servergroup : " + serverGroup.getName() + " prefix:" + serverGroup.getPrefix());
if (!serverGroup.getServerNpcName().isEmpty()) if (!serverGroup.getServerNpcName().isEmpty())
{
AddServerNpc(serverGroup); AddServerNpc(serverGroup);
System.out.println("Adding to npcs");
}
if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty()) if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty())
{ {

View File

@ -8,6 +8,6 @@ public class ServerCountSorter implements Comparator<ServerInfo>
{ {
public int compare(ServerInfo a, ServerInfo b) public int compare(ServerInfo a, ServerInfo b)
{ {
return a.CurrentPlayers - b.CurrentPlayers; return b.CurrentPlayers - a.CurrentPlayers;
} }
} }

View File

@ -52,23 +52,6 @@ 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[]
{
ChatColor.RESET + "Solo Mode",
ChatColor.RESET + "",
ChatColor.RESET + "Click to play!",
ChatColor.RESET + "",
ChatColor.RESET + "Teaming in Solo Mode is bannable!",
}));
setItem(14, ItemStackFactory.Instance.CreateStack(Material.SKULL.getId(), (byte)0, 2, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Play Team " + C.cGray + getName(), new String[]
{
ChatColor.RESET + "Team Mode",
ChatColor.RESET + "",
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;

View File

@ -48,8 +48,6 @@ public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
@Override @Override
protected void buildPage() protected void buildPage()
{ {
String name = _serverGroup.getName();
String friendlyName = _serverGroup.getServerNpcName(); String friendlyName = _serverGroup.getServerNpcName();
setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 1, ChatColor.RESET + C.cYellow + "Solo " + friendlyName, new String[] setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 1, ChatColor.RESET + C.cYellow + "Solo " + friendlyName, new String[]