OMG WTF BBQ IT WORKS. LETS IRON OUT BUGS AND GET OUR RELEASE TARGET, ONLY 12 HOURS LEFT.

This commit is contained in:
md_5 2013-03-11 09:18:39 +11:00
parent 6e18403cd9
commit fa5804ec86
5 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,5 @@
package net.md_5.bungee.api.connection; package net.md_5.bungee.api.connection;
import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
/** /**

View File

@ -4,6 +4,7 @@ import io.netty.channel.Channel;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.packet.Packet1Login; import net.md_5.bungee.packet.Packet1Login;
@ -20,6 +21,9 @@ public class ServerConnection implements Server
private final ServerInfo info; private final ServerInfo info;
@Getter @Getter
private final Packet1Login loginPacket; private final Packet1Login loginPacket;
@Getter
@Setter
private boolean isObsolete;
@Override @Override
public void sendData(String channel, byte[] data) public void sendData(String channel, byte[] data)

View File

@ -91,11 +91,12 @@ public class ServerConnector extends PacketHandler
user.ch.write( new Packet9Respawn( login.dimension, login.difficulty, login.gameMode, (short) 256, login.levelType ) ); user.ch.write( new Packet9Respawn( login.dimension, login.difficulty, login.gameMode, (short) 256, login.levelType ) );
// Remove from old servers // Remove from old servers
user.getServer().setObsolete( true );
user.getServer().disconnect( "Quitting" ); user.getServer().disconnect( "Quitting" );
user.getServer().getInfo().removePlayer( user );
} }
// Add to new server // Add to new server
// TODO: Move this to the connected() method of DownstreamBridge
target.addPlayer( user ); target.addPlayer( user );
user.setServer( server ); user.setServer( server );

View File

@ -7,6 +7,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.md_5.bungee.EntityMap; import net.md_5.bungee.EntityMap;
import net.md_5.bungee.ServerConnection;
import net.md_5.bungee.UserConnection; import net.md_5.bungee.UserConnection;
import net.md_5.bungee.Util; import net.md_5.bungee.Util;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -28,7 +29,7 @@ public class DownstreamBridge extends PacketHandler
private final ProxyServer bungee; private final ProxyServer bungee;
private final UserConnection con; private final UserConnection con;
private final Server server; private final ServerConnection server;
@Override @Override
public void exception(Throwable t) throws Exception public void exception(Throwable t) throws Exception
@ -43,7 +44,9 @@ public class DownstreamBridge extends PacketHandler
server.getInfo().removePlayer( con ); server.getInfo().removePlayer( con );
bungee.getReconnectHandler().setServer( con ); bungee.getReconnectHandler().setServer( con );
if (!server.isObsolete()){
con.disconnect( "[Proxy] Lost connection to server D:" ); con.disconnect( "[Proxy] Lost connection to server D:" );
}
} }
@Override @Override

View File

@ -41,7 +41,6 @@ public class UpstreamBridge extends PacketHandler
{ {
con.getServer().disconnect( "Quitting" ); con.getServer().disconnect( "Quitting" );
} }
} }
@Override @Override