Skip to content

Commit

Permalink
fix mcc not showing the disconnect message
Browse files Browse the repository at this point in the history
The fix is to remove the ParseText call from the OnConnectionLost call, as the ReadNextChat function already calls ParseText. Calling ParseText on an unparsable string returns an empty string, therefore the disconnect message never gets propagated to the user.
  • Loading branch information
breadbyte committed Mar 16, 2024
1 parent 706a41e commit dc71332
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MinecraftClient/McClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public void OnConnectionLost(ChatBot.DisconnectReason reason, string message)
ConsoleInteractive.ConsoleReader.StopReadThread();
ConsoleInteractive.ConsoleReader.MessageReceived -= ConsoleReaderOnMessageReceived;
ConsoleInteractive.ConsoleReader.OnInputChange -= ConsoleIO.AutocompleteHandler;
Program.HandleFailure(message, false, reason);
Program.HandleFailure(null, false, reason);
}
}

Expand Down
4 changes: 2 additions & 2 deletions MinecraftClient/Protocol/Handlers/Protocol18.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2044,8 +2044,8 @@ private bool HandlePlayPackets(int packetId, Queue<byte> packetData)
handler.OnPluginChannelMessage(channel, packetData.ToArray());
return pForge.HandlePluginMessage(channel, packetData, ref currentDimension);
case PacketTypesIn.Disconnect:
handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick,
ChatParser.ParseText(dataTypes.ReadNextChat(packetData)));
handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick,
dataTypes.ReadNextChat(packetData));
return false;
case PacketTypesIn.SetCompression:
if (protocolVersion is >= MC_1_8_Version and < MC_1_9_Version)
Expand Down

0 comments on commit dc71332

Please sign in to comment.