Fixed reconnect for bungee connection in StatusHistoryRepository
Added error catching to ServerMonitor so it doesn't stall program.
This commit is contained in:
parent
ff56578d15
commit
9d3f5f9bc8
@ -146,9 +146,9 @@ public class ServerMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator<DedicatedServer> iterator = _dedicatedServers.iterator(); iterator.hasNext();)
|
for (Iterator<DedicatedServer> iterator = _dedicatedServers.iterator(); iterator.hasNext();)
|
||||||
{
|
{
|
||||||
DedicatedServer serverData = iterator.next();
|
DedicatedServer serverData = iterator.next();
|
||||||
|
|
||||||
if (_badServers.containsKey(serverData.getName()))
|
if (_badServers.containsKey(serverData.getName()))
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
else
|
else
|
||||||
@ -176,17 +176,24 @@ public class ServerMonitor
|
|||||||
|
|
||||||
for (Iterator<MinecraftServer> serverIterator = groupStatus.getServers().iterator(); serverIterator.hasNext();)
|
for (Iterator<MinecraftServer> serverIterator = groupStatus.getServers().iterator(); serverIterator.hasNext();)
|
||||||
{
|
{
|
||||||
MinecraftServer server = serverIterator.next();
|
try
|
||||||
int serverNum = Integer.parseInt(server.getName().split("-")[1]);
|
|
||||||
|
|
||||||
if (serverMap.containsKey(serverNum))
|
|
||||||
{
|
{
|
||||||
killServer(server.getName(), server.getPublicAddress(), server.getPlayerCount(), "[KILLED] [DUPLICATE] " + server.getName() + ":" + server.getPublicAddress(), true);
|
MinecraftServer server = serverIterator.next();
|
||||||
serverIterator.remove();
|
int serverNum = Integer.parseInt(server.getName().split("-")[1]);
|
||||||
|
|
||||||
|
if (serverMap.containsKey(serverNum))
|
||||||
|
{
|
||||||
|
killServer(server.getName(), server.getPublicAddress(), server.getPlayerCount(), "[KILLED] [DUPLICATE] " + server.getName() + ":" + server.getPublicAddress(), true);
|
||||||
|
serverIterator.remove();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serverMap.put(serverNum, server);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
serverMap.put(serverNum, server);
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ public class StatusHistoryRepository
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_bungeeconnection == null || _bungeeconnection.isClosed())
|
if (_bungeeconnection == null || _bungeeconnection.isClosed())
|
||||||
_bungeeconnection = DriverManager.getConnection(_connectionString, _userName, _password);
|
_bungeeconnection = DriverManager.getConnection(_bungeeConnectionString, _userName, _password);
|
||||||
|
|
||||||
retrieveStatement = _bungeeconnection.prepareStatement(RETRIEVE_BUNGEE_STATUSES);
|
retrieveStatement = _bungeeconnection.prepareStatement(RETRIEVE_BUNGEE_STATUSES);
|
||||||
ResultSet resultSet = retrieveStatement.executeQuery();
|
ResultSet resultSet = retrieveStatement.executeQuery();
|
||||||
|
Loading…
Reference in New Issue
Block a user