Send action bar messages using BaseComponent for 1.9 clients

Action Bar packets in 1.9 now correctly support the JSON format, however sending them the 1.8 way will kick the client. This keeps the compatibility with 1.8 clients with the version check whilst correctly sending the packet to 1.9 clients.
This commit is contained in:
Youri Kersten 2016-03-01 09:12:47 +01:00 committed by md_5
parent 7926230682
commit b6671cd00c

View File

@ -416,8 +416,8 @@ public final class UserConnection implements ProxiedPlayer
@Override
public void sendMessage(ChatMessageType position, BaseComponent... message)
{
// Action bar doesn't display the new JSON formattings, legacy works - send it using this for now
if ( position == ChatMessageType.ACTION_BAR )
// Action bar on 1.8 doesn't display the new JSON formattings, legacy works - send it using this for now
if ( position == ChatMessageType.ACTION_BAR && getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_8 )
{
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
} else
@ -429,8 +429,8 @@ public final class UserConnection implements ProxiedPlayer
@Override
public void sendMessage(ChatMessageType position, BaseComponent message)
{
// Action bar doesn't display the new JSON formattings, legacy works - send it using this for now
if ( position == ChatMessageType.ACTION_BAR )
// Action bar on 1.8 doesn't display the new JSON formattings, legacy works - send it using this for now
if ( position == ChatMessageType.ACTION_BAR && getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_8 )
{
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
} else