Fixed minor bug in ServerMonitor.

This commit is contained in:
Jonathan Williams 2015-01-10 11:53:51 -08:00
parent 8de8d31eec
commit 0d27649e85

View File

@ -97,7 +97,7 @@ public class ServerMonitor
{
if (minecraftServer.getMotd().contains("Finished") || (minecraftServer.getGroup().equalsIgnoreCase("UltraHardcore") && minecraftServer.getMotd().contains("Restarting") && minecraftServer.getPlayerCount() == 0))
{
killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true);
killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), minecraftServer.getPlayerCount(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true);
handleUserServerGroup(_serverGroupMap.get(minecraftServer.getGroup()));
continue;
@ -156,7 +156,7 @@ public class ServerMonitor
if (serverMap.containsKey(serverNum))
{
killServer(server.getName(), server.getPublicAddress(), "[KILLED] [DUPLICATE] " + server.getName() + ":" + server.getPublicAddress(), true);
killServer(server.getName(), server.getPublicAddress(), server.getPlayerCount(), "[KILLED] [DUPLICATE] " + server.getName() + ":" + server.getPublicAddress(), true);
serverIterator.remove();
}
else
@ -197,7 +197,7 @@ public class ServerMonitor
{
String serverName = entry.getKey();
String serverAddress = entry.getValue().getKey();
killServer(serverName, serverAddress, "[KILLED] [SLOW-STARTUP] " + serverName + ":" + serverAddress, true);
killServer(serverName, serverAddress, 0, "[KILLED] [SLOW-STARTUP] " + serverName + ":" + serverAddress, true);
iterator.remove();
}
}
@ -284,14 +284,14 @@ public class ServerMonitor
{
if (deadServers.contains(deadServer.getName()))
{
killServer(deadServer.getName(), deadServer.getPublicAddress(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup()));
}
else
{
_deadServers.add(deadServer.getName());
System.out.println("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
}
}
}
@ -399,7 +399,7 @@ public class ServerMonitor
}
}
private static void killServer(final String serverName, final String serverAddress, final String message, final boolean announce)
private static void killServer(final String serverName, final String serverAddress, final int players, final String message, final boolean announce)
{
if (_debug)
return;
@ -411,9 +411,11 @@ public class ServerMonitor
{
public void run(Boolean error)
{
MinecraftServer server = null;
if (!error)
{
MinecraftServer server = _repository.getServerStatus(serverName);
server = _repository.getServerStatus(serverName);
if (server != null)
{
@ -426,7 +428,7 @@ public class ServerMonitor
if (error)
log("[" + serverName + ":" + serverAddress + "] Kill errored.");
else
log(message);
log(message + " Players: " + players);
}
}
});
@ -505,7 +507,7 @@ public class ServerMonitor
private static void killServer(final MinecraftServer serverToKill, String message)
{
killServer(serverToKill.getName(), serverToKill.getPublicAddress(), message, true);
killServer(serverToKill.getName(), serverToKill.getPublicAddress(), serverToKill.getPlayerCount(), message, true);
}
private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free)