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

Commit

Permalink
Merge pull request #98 from SpigotMC/master
Browse files Browse the repository at this point in the history
Merge with SpigotMC.
  • Loading branch information
sleiss authored Nov 14, 2016
2 parents 939b922 + 72002ed commit 9f1f721
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_8, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x48 ),
map( ProtocolConstants.MINECRAFT_1_9_4, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_10, 0x47 )
map( ProtocolConstants.MINECRAFT_1_10, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_11, 0x47 )
);
TO_CLIENT.registerPacket(
SetCompression.class,
Expand Down
23 changes: 21 additions & 2 deletions protocol/src/main/java/net/md_5/bungee/protocol/packet/Title.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,20 @@ public class Title extends DefinedPacket
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
action = Action.values()[readVarInt( buf )];
int index = readVarInt( buf );

// If we're working on 1.10 or lower, increment the value of the index so we pull out the correct value.
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_10 && index <= 2 )
{
index++;
}

action = Action.values()[index];
switch ( action )
{
case TITLE:
case SUBTITLE:
case ACTIONBAR:
text = readString( buf );
break;
case TIMES:
Expand All @@ -46,11 +55,20 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
writeVarInt( action.ordinal(), buf );
int index = readVarInt( buf );

// If we're working on 1.10 or lower, increment the value of the index so we pull out the correct value.
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_10 && index <= 2 )
{
index++;
}

action = Action.values()[index];
switch ( action )
{
case TITLE:
case SUBTITLE:
case ACTIONBAR:
writeString( text, buf );
break;
case TIMES:
Expand All @@ -72,6 +90,7 @@ public static enum Action

TITLE,
SUBTITLE,
ACTIONBAR,
TIMES,
CLEAR,
RESET
Expand Down

0 comments on commit 9f1f721

Please sign in to comment.