Fixed up lobby balancer.

This commit is contained in:
Jonathan Williams 2013-08-30 02:24:39 -07:00
parent 90de0c3ed2
commit 6302869c02

View File

@ -34,8 +34,6 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
@EventHandler
public void playerConnect(ServerConnectEvent event)
{
System.out.println(event.getPlayer().getName() + " connecting to " + event.getTarget().getName());
if (!event.getTarget().getName().equalsIgnoreCase("Lobby"))
return;
@ -44,6 +42,9 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
for (Entry<String, Integer> entry : _lobbyServers.entrySet())
{
if (entry.getValue() == 999)
continue;
if (bestServer == null)
{
bestServer = entry.getKey();
@ -127,15 +128,16 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
}
catch (SocketTimeoutException e)
{
;
_lobbyServers.put(name, 999);
}
catch (ConnectException e)
{
;
_lobbyServers.put(name, 999);
}
catch (IOException e)
{
System.out.println("[LobbyBalancer] Error pinging " + address.getHostString() + ":" + address.getPort());
System.out.println("[LobbyBalancer IOException] Error pinging " + address.getHostString() + ":" + address.getPort());
_lobbyServers.put(name, 999);
throw e;
}
finally