Fixed up lobby balancer.
This commit is contained in:
parent
90de0c3ed2
commit
6302869c02
@ -34,8 +34,6 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerConnect(ServerConnectEvent event)
|
public void playerConnect(ServerConnectEvent event)
|
||||||
{
|
{
|
||||||
System.out.println(event.getPlayer().getName() + " connecting to " + event.getTarget().getName());
|
|
||||||
|
|
||||||
if (!event.getTarget().getName().equalsIgnoreCase("Lobby"))
|
if (!event.getTarget().getName().equalsIgnoreCase("Lobby"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -44,6 +42,9 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
|
|||||||
|
|
||||||
for (Entry<String, Integer> entry : _lobbyServers.entrySet())
|
for (Entry<String, Integer> entry : _lobbyServers.entrySet())
|
||||||
{
|
{
|
||||||
|
if (entry.getValue() == 999)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (bestServer == null)
|
if (bestServer == null)
|
||||||
{
|
{
|
||||||
bestServer = entry.getKey();
|
bestServer = entry.getKey();
|
||||||
@ -127,15 +128,16 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
|
|||||||
}
|
}
|
||||||
catch (SocketTimeoutException e)
|
catch (SocketTimeoutException e)
|
||||||
{
|
{
|
||||||
;
|
_lobbyServers.put(name, 999);
|
||||||
}
|
}
|
||||||
catch (ConnectException e)
|
catch (ConnectException e)
|
||||||
{
|
{
|
||||||
;
|
_lobbyServers.put(name, 999);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
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;
|
throw e;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user