Don't rewrite the actual host packet, just a copy.

This commit is contained in:
md_5 2013-11-05 18:07:55 +11:00
parent 61326db3ee
commit 14371a1a8c
2 changed files with 8 additions and 6 deletions

View File

@ -24,6 +24,7 @@ import net.md_5.bungee.protocol.MinecraftOutput;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.Login;
import net.md_5.bungee.protocol.packet.Respawn;
import net.md_5.bungee.protocol.packet.ScoreboardObjective;
@ -71,7 +72,13 @@ public class ServerConnector extends PacketHandler
out.writeInt( user.getAddress().getPort() );
// channel.write( new PluginMessage( "BungeeCord", out.toByteArray() ) ); MOJANG
channel.write( user.getPendingConnection().getHandshake() );
Handshake originalHandshake = user.getPendingConnection().getHandshake();
Handshake copiedHandshake = new Handshake( originalHandshake.getProtocolVersion(), originalHandshake.getHost(), originalHandshake.getPort(), 2 );
if ( BungeeCord.getInstance().config.isIpFoward() )
{
copiedHandshake.setHost( copiedHandshake.getHost() + "\00" + user.getAddress().getHostString() );
}
channel.write( copiedHandshake );
channel.setProtocol( Protocol.LOGIN );
channel.write( user.getPendingConnection().getLoginRequest() );

View File

@ -193,11 +193,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
this.vHost = new InetSocketAddress( handshake.getHost(), handshake.getPort() );
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
if ( BungeeCord.getInstance().config.isIpFoward() )
{
handshake.setHost( handshake.getHost() + "\00" + getAddress().getHostString() );
}
bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) );
switch ( handshake.getRequestedProtocol() )