diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java index f29f1cd09..bd19c0d8f 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java @@ -6,9 +6,11 @@ import java.util.List; public class GroupStatusData { + private int _serverNum = 0; private int _totalCount = 0; private int _joinableCount = 0; + private int _freeServerNum = 0; private int _freeTotalCount = 0; private int _freeJoinableCount = 0; @@ -135,22 +137,33 @@ public class GroupStatusData public int getNextServerNumber(boolean free) { - int startNumber = 1; + if (free) + _freeServerNum++; + else + _serverNum++; while (true) { if (free) { - if (!FreeServers.containsKey(startNumber)) - return startNumber; + if (!FreeServers.containsKey(_freeServerNum)) + break; } else { - if (!Servers.containsKey(startNumber)) - return startNumber; + if (!Servers.containsKey(_serverNum)) + break; } - startNumber++; + if (free) + _freeServerNum++; + else + _serverNum++; } + + if (free) + return _freeServerNum; + else + return _serverNum; } } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index d14b30ca6..dbedf19e4 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -149,7 +149,7 @@ public class ServerMonitor handleGroupChanges(dynamicServers, serverTracker, serverGroup, groupStatus, false); - if (serverGroup.GenerateFreeVersions && _count % 2 == 0) + if (serverGroup.GenerateFreeVersions && _count % 6 == 0) { handleGroupChanges(dynamicServers, serverTracker, serverGroup, groupStatus, true); } @@ -246,12 +246,12 @@ public class ServerMonitor break; } - if (serverTracker.containsKey(serverGroup.Prefix + "-" + serverNum)) + if (serverTracker.containsKey(serverGroup.Prefix + "-" + serverNum + (free ? "-FREE" : ""))) System.out.println("[WAITING] On " + serverGroup.Prefix + "-" + serverNum + " to finish starting..."); else { startServer(bestServer, serverGroup, serverNum, free); - serverTracker.put(serverGroup.Prefix + "-" + serverNum, new AbstractMap.SimpleEntry(bestServer.Address, System.currentTimeMillis())); + serverTracker.put(serverGroup.Prefix + "-" + serverNum + (free ? "-FREE" : ""), new AbstractMap.SimpleEntry(bestServer.Address, System.currentTimeMillis())); } serversToAdd--;