Only save to reconnectHandler if we have a listener that isn't forcing to the default server

This commit is contained in:
Ammar Askar 2013-08-13 11:24:38 +03:00 committed by md_5
parent f948acd634
commit 51e92de2dd
3 changed files with 24 additions and 8 deletions

View File

@ -240,9 +240,13 @@ public class BungeeCord extends ProxyServer
pluginsFolder.mkdir();
pluginManager.detectPlugins( pluginsFolder );
config.load();
if ( reconnectHandler == null )
for ( ListenerInfo info : config.getListeners() )
{
reconnectHandler = new YamlReconnectHandler();
if ( !info.isForceDefault() && reconnectHandler == null )
{
reconnectHandler = new YamlReconnectHandler();
break;
}
}
isRunning = true;
@ -342,8 +346,11 @@ public class BungeeCord extends ProxyServer
}
getLogger().info( "Saving reconnect locations" );
reconnectHandler.save();
reconnectHandler.close();
if ( reconnectHandler != null )
{
reconnectHandler.save();
reconnectHandler.close();
}
saveThread.cancel();
metricsThread.cancel();

View File

@ -32,7 +32,6 @@ import net.md_5.bungee.protocol.packet.PacketD1Team;
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
import net.md_5.bungee.protocol.packet.PacketFFKick;
;
@RequiredArgsConstructor
public class DownstreamBridge extends PacketHandler
@ -62,7 +61,10 @@ public class DownstreamBridge extends PacketHandler
{
// We lost connection to the server
server.getInfo().removePlayer( con );
bungee.getReconnectHandler().setServer( con );
if (bungee.getReconnectHandler() != null)
{
bungee.getReconnectHandler().setServer( con );
}
if ( !server.isObsolete() )
{

View File

@ -335,14 +335,21 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
Preconditions.checkState( thisState == State.LOGIN, "Not expecting LOGIN" );
UserConnection userCon = new UserConnection( (BungeeCord) bungee, ch, getName(), this );
UserConnection userCon = new UserConnection( bungee, ch, getName(), this );
userCon.init();
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );
ServerInfo server = bungee.getReconnectHandler().getServer( userCon );
ServerInfo server;
if ( bungee.getReconnectHandler() != null )
{
server = bungee.getReconnectHandler().getServer( userCon );
} else
{
server = AbstractReconnectManager.getForcedHost( this );
}
userCon.connect( server, true );
thisState = State.FINISHED;