Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
1.9.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 authored and Thinkofname committed Mar 30, 2016
1 parent 891ad87 commit 6b4e285
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
9 changes: 6 additions & 3 deletions protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public enum Protocol
public static final int MAX_PACKET_ID = 0xFF;
public static List<Integer> supportedVersions = Arrays.asList(
ProtocolConstants.MINECRAFT_1_8,
ProtocolConstants.MINECRAFT_1_9
ProtocolConstants.MINECRAFT_1_9,
ProtocolConstants.MINECRAFT_1_9_1
);
/*========================================================================*/
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
Expand All @@ -131,8 +132,10 @@ public class DirectionData
{
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
packetRemap.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemapInv.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemap.put( ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemap.put( ProtocolConstants.MINECRAFT_1_9_1, packetRemap.get( ProtocolConstants.MINECRAFT_1_9 ) );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_9_1, packetRemapInv.get( ProtocolConstants.MINECRAFT_1_9 ) );
}

public final DefinedPacket createPacket(int id, int protocol)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@

public class ProtocolConstants
{

public static final int MINECRAFT_1_8 = 47;
public static final int MINECRAFT_1_9 = 107;
public static final int MINECRAFT_1_9_1 = 108;
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
"1.8.x",
"1.9"
"1.9",
"1.9.1"
);

public enum Direction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class EncryptionRequest extends DefinedPacket
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
serverId = readString( buf );
publicKey = readArray( buf );
verifyToken = readArray( buf );
publicKey = readArray( buf, 128 );
verifyToken = readArray( buf, 128 );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class EncryptionResponse extends DefinedPacket
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
sharedSecret = readArray( buf, 256 );
verifyToken = readArray( buf, 256 );
sharedSecret = readArray( buf, 128 );
verifyToken = readArray( buf, 128 );
}

@Override
Expand Down
16 changes: 14 additions & 2 deletions protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
{
entityId = buf.readInt();
gameMode = buf.readUnsignedByte();
dimension = buf.readByte();
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
{
dimension = buf.readInt();
} else
{
dimension = buf.readByte();
}
difficulty = buf.readUnsignedByte();
maxPlayers = buf.readUnsignedByte();
levelType = readString( buf );
Expand All @@ -44,7 +50,13 @@ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protoc
{
buf.writeInt( entityId );
buf.writeByte( gameMode );
buf.writeByte( dimension );
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
{
buf.writeInt( dimension );
} else
{
buf.writeByte( dimension );
}
buf.writeByte( difficulty );
buf.writeByte( maxPlayers );
writeString( levelType, buf );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static EntityMap getEntityMap(int version)
case ProtocolConstants.MINECRAFT_1_8:
return EntityMap_1_8.INSTANCE;
case ProtocolConstants.MINECRAFT_1_9:
case ProtocolConstants.MINECRAFT_1_9_1:
return EntityMap_1_9.INSTANCE;
}
throw new RuntimeException( "Version " + version + " has no entity map" );
Expand Down

0 comments on commit 6b4e285

Please sign in to comment.