From b9bca4281feec7e630e670cb4e0bd65180f49542 Mon Sep 17 00:00:00 2001 From: Gjum Date: Sat, 8 Nov 2025 05:06:57 +0100 Subject: [PATCH] fix chat parsing --- botcraft/src/Game/ConnectionClient.cpp | 10 +++++----- protocolCraft/src/Types/Chat/Chat.cpp | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/botcraft/src/Game/ConnectionClient.cpp b/botcraft/src/Game/ConnectionClient.cpp index 7748dc13..508fd9d9 100644 --- a/botcraft/src/Game/ConnectionClient.cpp +++ b/botcraft/src/Game/ConnectionClient.cpp @@ -94,7 +94,7 @@ namespace Botcraft void ConnectionClient::Handle(ClientboundLoginDisconnectPacket& packet) { #if PROTOCOL_VERSION < 765 /* < 1.20.3 */ - LOG_INFO("Disconnect during login with reason: " << packet.GetReason().GetRawText()); + LOG_INFO("Disconnect during login with reason: " << packet.GetReason().GetText()); #else LOG_INFO("Disconnect during login with reason: " << packet.GetReason()); #endif @@ -122,9 +122,9 @@ namespace Botcraft void ConnectionClient::Handle(ClientboundDisconnectPacket& packet) { #if PROTOCOL_VERSION < 765 /* < 1.20.3 */ - LOG_INFO("Disconnect during playing with reason: " << packet.GetReason().GetRawText()); + LOG_INFO("Disconnect during playing with reason: " << packet.GetReason().GetText()); #else - LOG_INFO("Disconnect during playing with reason: " << packet.GetReason().Serialize().Dump()); + LOG_INFO("Disconnect during playing with reason: " << packet.GetReason().GetText()); #endif should_be_closed = true; @@ -143,9 +143,9 @@ namespace Botcraft void ConnectionClient::Handle(ClientboundDisconnectConfigurationPacket& packet) { #if PROTOCOL_VERSION < 765 /* < 1.20.3 */ - LOG_INFO("Disconnect during configuration with reason: " << packet.GetReason().GetRawText()); + LOG_INFO("Disconnect during configuration with reason: " << packet.GetReason().GetText()); #else - LOG_INFO("Disconnect during configuration with reason: " << packet.GetReason().Serialize().Dump()); + LOG_INFO("Disconnect during configuration with reason: " << packet.GetReason().GetText()); #endif should_be_closed = true; diff --git a/protocolCraft/src/Types/Chat/Chat.cpp b/protocolCraft/src/Types/Chat/Chat.cpp index 1800e650..7eb3bebb 100644 --- a/protocolCraft/src/Types/Chat/Chat.cpp +++ b/protocolCraft/src/Types/Chat/Chat.cpp @@ -92,10 +92,15 @@ namespace ProtocolCraft } // Add extra - if (raw.contains("extra") && raw["extra"].is_list_of()) + if (raw.contains("extra") && raw["extra"].is_list_of()) + { + for (const auto& s : raw["extra"].as_list_of()) + output += s; + } + else if (raw.contains("extra") && raw["extra"].is_list_of()) { for (const auto& t : raw["extra"].as_list_of()) - output += ParseChat(t); + output += ParseChat(t); } return output;