1.7.6-pre1 Support

This commit is contained in:
Thinkofdeath 2014-04-04 11:25:19 +01:00 committed by md_5
parent 13848def72
commit 1d3adc5317
4 changed files with 13 additions and 6 deletions

View File

@ -97,7 +97,7 @@ public enum Protocol
}; };
/*========================================================================*/ /*========================================================================*/
public static final int MAX_PACKET_ID = 0xFF; public static final int MAX_PACKET_ID = 0xFF;
public static List<Integer> supportedVersions = Arrays.asList( 4, 8 ); public static List<Integer> supportedVersions = Arrays.asList( 4, 5, 8 );
/*========================================================================*/ /*========================================================================*/
public final ProtocolDirection TO_SERVER = new ProtocolDirection( "TO_SERVER" ); public final ProtocolDirection TO_SERVER = new ProtocolDirection( "TO_SERVER" );
public final ProtocolDirection TO_CLIENT = new ProtocolDirection( "TO_CLIENT" ); public final ProtocolDirection TO_CLIENT = new ProtocolDirection( "TO_CLIENT" );

View File

@ -28,7 +28,7 @@ public class Chat extends DefinedPacket
public void read(ByteBuf buf, Protocol.ProtocolDirection direction, int protocolVersion) public void read(ByteBuf buf, Protocol.ProtocolDirection direction, int protocolVersion)
{ {
message = readString( buf ); message = readString( buf );
if ( direction.toString().equals( "TO_CLIENT" ) && protocolVersion >= 5 ) if ( direction.toString().equals( "TO_CLIENT" ) && protocolVersion >= 7 )
{ {
position = buf.readByte(); position = buf.readByte();
} }
@ -38,7 +38,7 @@ public class Chat extends DefinedPacket
public void write(ByteBuf buf, Protocol.ProtocolDirection direction, int protocolVersion) public void write(ByteBuf buf, Protocol.ProtocolDirection direction, int protocolVersion)
{ {
writeString( message, buf ); writeString( message, buf );
if ( direction.toString().equals( "TO_CLIENT" ) && protocolVersion >= 5 ) if ( direction.toString().equals( "TO_CLIENT" ) && protocolVersion >= 7 )
{ {
buf.writeByte( position ); buf.writeByte( position );
} }

View File

@ -30,7 +30,7 @@ public class ClientSettings extends DefinedPacket
viewDistance = buf.readByte(); viewDistance = buf.readByte();
chatFlags = buf.readByte(); chatFlags = buf.readByte();
unknown = buf.readBoolean(); unknown = buf.readBoolean();
if ( protocolVersion < 5 ) if ( protocolVersion < 6 )
{ {
difficulty = buf.readByte(); difficulty = buf.readByte();
} }
@ -44,7 +44,7 @@ public class ClientSettings extends DefinedPacket
buf.writeByte( viewDistance ); buf.writeByte( viewDistance );
buf.writeByte( chatFlags ); buf.writeByte( chatFlags );
buf.writeBoolean( unknown ); buf.writeBoolean( unknown );
if ( protocolVersion < 5 ) if ( protocolVersion < 6 )
{ {
buf.writeByte( difficulty ); buf.writeByte( difficulty );
} }

View File

@ -371,7 +371,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
uniqueId = java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) ); uniqueId = java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );
} }
unsafe.sendPacket( new LoginSuccess( uniqueId.toString(), getName() ) ); // Version 5 == 1.7.6. This is a screwup as 1.7.6 was also a snapshot.
if ( getVersion() == 5 )
{
unsafe.sendPacket( new LoginSuccess( getUniqueId().toString(), getName() ) ); // With dashes in between
} else
{
unsafe.sendPacket( new LoginSuccess( getUUID(), getName() ) ); // Without dashes, for older clients.
}
ch.setProtocol( Protocol.GAME ); ch.setProtocol( Protocol.GAME );
UserConnection userCon = new UserConnection( bungee, ch, getName(), InitialHandler.this ); UserConnection userCon = new UserConnection( bungee, ch, getName(), InitialHandler.this );