Generate offline mode UUIDs the same way Mojang does.

This commit is contained in:
md_5 2013-12-16 22:41:13 +11:00
parent 359e2b2a16
commit 60d6f31876

View File

@ -1,5 +1,6 @@
package net.md_5.bungee.connection; package net.md_5.bungee.connection;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -362,7 +363,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
if ( UUID == null ) if ( UUID == null )
{ {
UUID = java.util.UUID.randomUUID().toString(); UUID = java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) ).toString();
} }
unsafe.sendPacket( new LoginSuccess( UUID, getName() ) ); unsafe.sendPacket( new LoginSuccess( UUID, getName() ) );
ch.setProtocol( Protocol.GAME ); ch.setProtocol( Protocol.GAME );