Fix offline mode. Latest snapshot appears to be pretty much functional, although the client itself seems to have some reliability issues.

This commit is contained in:
md_5 2013-10-19 20:01:22 +11:00
parent b7babd2888
commit cdf47d84d8
2 changed files with 9 additions and 5 deletions

View File

@ -40,9 +40,9 @@ public class EncryptionUtil
} }
} }
public static EncryptionRequest encryptRequest(boolean onlinemode) public static EncryptionRequest encryptRequest()
{ {
String hash = ( onlinemode ) ? Long.toString( random.nextLong(), 16 ) : "-"; String hash = Long.toString( random.nextLong(), 16 );
byte[] pubKey = keys.getPublic().getEncoded(); byte[] pubKey = keys.getPublic().getEncoded();
byte[] verify = new byte[ 4 ]; byte[] verify = new byte[ 4 ];
random.nextBytes( verify ); random.nextBytes( verify );

View File

@ -1,8 +1,6 @@
package net.md_5.bungee.connection; package net.md_5.bungee.connection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -249,7 +247,13 @@ public class InitialHandler extends PacketHandler implements PendingConnection
// TODO: Nuuuu Mojang why u do this // TODO: Nuuuu Mojang why u do this
// unsafe().sendPacket( PacketConstants.I_AM_BUNGEE ); // unsafe().sendPacket( PacketConstants.I_AM_BUNGEE );
// unsafe().sendPacket( PacketConstants.FORGE_MOD_REQUEST ); // unsafe().sendPacket( PacketConstants.FORGE_MOD_REQUEST );
unsafe().sendPacket( request = EncryptionUtil.encryptRequest( this.onlineMode ) ); if ( this.onlineMode )
{
unsafe().sendPacket( request = EncryptionUtil.encryptRequest() );
} else
{
finish();
}
thisState = State.ENCRYPT; thisState = State.ENCRYPT;
} }