From a7e69fd9fdf868f74561895eed3a800f6f6dc36c Mon Sep 17 00:00:00 2001 From: BruceChen Date: Fri, 14 Oct 2022 10:33:09 +0800 Subject: [PATCH] Update ConsoleInteractive --- ConsoleInteractive | 2 +- MinecraftClient/Protocol/Handlers/Protocol18.cs | 17 +++++++++++++++-- MinecraftClient/Protocol/Message/ChatParser.cs | 6 ++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ConsoleInteractive b/ConsoleInteractive index 225b10ec..42074c44 160000 --- a/ConsoleInteractive +++ b/ConsoleInteractive @@ -1 +1 @@ -Subproject commit 225b10ec96af5c8f179a008cc442b502d23bc601 +Subproject commit 42074c449b8cf32e035f982bd83af6dcf75bc764 diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 5b00b26e..4db4b661 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -553,6 +553,19 @@ namespace MinecraftClient.Protocol.Handlers (messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING || messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING)) senderTeamName = Json.ParseJson(targetName).Properties["with"].DataArray[0].Properties["text"].StringValue; + if (string.IsNullOrWhiteSpace(senderDisplayName)) + { + PlayerInfo? player = handler.GetPlayerInfo(senderUUID); + if (player != null && (player.DisplayName != null || player.Name != null) && string.IsNullOrWhiteSpace(senderDisplayName)) + { + senderDisplayName = ChatParser.ParseText(player.DisplayName ?? player.Name); + if (string.IsNullOrWhiteSpace(senderDisplayName)) + senderDisplayName = player.DisplayName ?? player.Name; + else + senderDisplayName += "§r"; + } + } + bool verifyResult; if (!isOnlineMode) verifyResult = false; @@ -1382,8 +1395,8 @@ namespace MinecraftClient.Protocol.Handlers byte windowID = dataTypes.ReadNextByte(packetData); short actionID = dataTypes.ReadNextShort(packetData); bool accepted = dataTypes.ReadNextBool(packetData); - if (!accepted && actionID > 0) - SendWindowConfirmation(windowID, actionID, accepted); + if (!accepted) + SendWindowConfirmation(windowID, actionID, true); } break; case PacketTypesIn.ResourcePackSend: diff --git a/MinecraftClient/Protocol/Message/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs index dc29f421..d000cfe9 100644 --- a/MinecraftClient/Protocol/Message/ChatParser.cs +++ b/MinecraftClient/Protocol/Message/ChatParser.cs @@ -47,8 +47,10 @@ namespace MinecraftClient.Protocol /// Returns the translated text public static string ParseSignedChat(ChatMessage message, List? links = null) { - string chatContent = Config.Signature.ShowModifiedChat && message.unsignedContent != null ? message.unsignedContent : message.content; - string content = message.isJson ? ParseText(chatContent, links) : chatContent; + string chatContent = (Config.Signature.ShowModifiedChat && message.unsignedContent != null) ? message.unsignedContent : message.content; + string content = ParseText(chatContent, links); + if (string.IsNullOrEmpty(content)) + content = chatContent; string sender = message.displayName!; string text;