Make server monitor support MCS and servers with multiple '-' characters
This commit is contained in:
parent
bd4fa1f2d4
commit
fe62e5a683
@ -325,7 +325,8 @@ public class ServerGroup
|
||||
String serverName = server.getName();
|
||||
try
|
||||
{
|
||||
int serverNum = Integer.parseInt(serverName.split("-")[1]);
|
||||
String[] nameArgs = serverName.split("-");
|
||||
int serverNum = Integer.parseInt(nameArgs[nameArgs.length - 1]);
|
||||
|
||||
if (serverNum == id)
|
||||
{
|
||||
|
@ -211,6 +211,14 @@ public class ServerMonitor
|
||||
|
||||
System.out.println("Removed MPS : " + groupStatus.getName());
|
||||
}
|
||||
if (groupStatus.getServerType().equalsIgnoreCase("Community"))
|
||||
{
|
||||
_repository.removeServerGroup(groupStatus);
|
||||
_serverGroupMap.remove(groupStatus.getName());
|
||||
groupStatusIterator.remove();
|
||||
|
||||
System.out.println("Removed MCS : " + groupStatus.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +234,8 @@ public class ServerMonitor
|
||||
try
|
||||
{
|
||||
MinecraftServer server = serverIterator.next();
|
||||
int serverNum = Integer.parseInt(server.getName().split("-")[1]);
|
||||
String[] nameArgs = server.getName().split("-");
|
||||
int serverNum = Integer.parseInt(nameArgs[nameArgs.length - 1]);
|
||||
|
||||
if (serverMap.containsKey(serverNum))
|
||||
{
|
||||
|
@ -9,9 +9,11 @@ public class ServerSorter implements Comparator<MinecraftServer>
|
||||
@Override
|
||||
public int compare(MinecraftServer first, MinecraftServer second)
|
||||
{
|
||||
if (Integer.parseInt(first.getName().split("-")[1]) < Integer.parseInt(second.getName().split("-")[1]))
|
||||
String[] args1 = first.getName().split("-");
|
||||
String[] args2 = second.getName().split("-");
|
||||
if (Integer.parseInt(args1[args1.length - 1]) < Integer.parseInt(args2[args2.length - 1]))
|
||||
return -1;
|
||||
else if (Integer.parseInt(second.getName().split("-")[1]) < Integer.parseInt(first.getName().split("-")[1]))
|
||||
else if (Integer.parseInt(args2[args2.length - 1]) < Integer.parseInt(args1[args1.length - 1]))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user