From b6671cd00c69bc98387bc6202cd1968c63f668ac Mon Sep 17 00:00:00 2001 From: Youri Kersten Date: Tue, 1 Mar 2016 09:12:47 +0100 Subject: [PATCH] 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. --- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 475559b2..c711c8cc 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -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