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:
parent
7926230682
commit
b6671cd00c
@ -416,8 +416,8 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(ChatMessageType position, BaseComponent... message)
|
public void sendMessage(ChatMessageType position, BaseComponent... message)
|
||||||
{
|
{
|
||||||
// Action bar doesn't display the new JSON formattings, legacy works - send it using this for now
|
// 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 )
|
if ( position == ChatMessageType.ACTION_BAR && getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_8 )
|
||||||
{
|
{
|
||||||
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
|
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
|
||||||
} else
|
} else
|
||||||
@ -429,8 +429,8 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(ChatMessageType position, BaseComponent message)
|
public void sendMessage(ChatMessageType position, BaseComponent message)
|
||||||
{
|
{
|
||||||
// Action bar doesn't display the new JSON formattings, legacy works - send it using this for now
|
// 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 )
|
if ( position == ChatMessageType.ACTION_BAR && getPendingConnection().getVersion() <= ProtocolConstants.MINECRAFT_1_8 )
|
||||||
{
|
{
|
||||||
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
|
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user