From 33d050583a882ab668a17e23e80651276f0dd2af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:26:11 +0000 Subject: [PATCH 1/2] Initial plan From 5c9319c10d9b1897703191dd17b93aaa3b06e615 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:43:50 +0000 Subject: [PATCH 2/2] Fix AutoRelog not triggering when initial TCP connection fails (server offline) When AutoRelog was enabled and the server was offline (SocketException during initial connection), AutoRelog's reconnection logic was never invoked. The Retry block's else branch either called HandleFailure() without a disconnect reason (so AutoRelog.OnDisconnectStatic was skipped) or did nothing at all. Now the else branch directly calls AutoRelog.OnDisconnectStatic with the standard "Connection has been lost" message (matching the default Kick_Messages), ensuring reconnection is properly triggered. Fixes MCCTeam/Minecraft-Console-Client#2781 Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/30698499-fdeb-44ce-9552-a64c4c5fb62b --- MinecraftClient/McClient.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 104ad218..913d48e5 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -313,19 +313,23 @@ namespace MinecraftClient } else { - // The AutoRelog ChatBot will handle reconnection at this point. - // This is important, or else we'll have multiple instances of the client running at the same time. + // AutoRelog is enabled - invoke its static handler to trigger reconnection. + // Use the same "Connection has been lost" message that OnConnectionLost uses + // for ConnectionLost, so it matches the default Kick_Messages. + if (AutoRelog.OnDisconnectStatic(ChatBot.DisconnectReason.ConnectionLost, Translations.mcc_disconnect_lost)) + return; // AutoRelog is triggering a restart - if (ReconnectionAttemptsLeft == 0) + // AutoRelog chose not to reconnect (e.g., message didn't match + // kick messages and Ignore_Kick_Message is false, or retry limit reached) + if (InternalConfig.InteractiveMode) { - if (InternalConfig.InteractiveMode) - { - ConsoleInteractive.ConsoleReader.StopReadThread(); - ConsoleInteractive.ConsoleReader.MessageReceived -= ConsoleReaderOnMessageReceived; - ConsoleInteractive.ConsoleReader.OnInputChange -= ConsoleIO.AutocompleteHandler; - Program.HandleFailure(); - } + ConsoleInteractive.ConsoleReader.StopReadThread(); + ConsoleInteractive.ConsoleReader.MessageReceived -= ConsoleReaderOnMessageReceived; + ConsoleInteractive.ConsoleReader.OnInputChange -= ConsoleIO.AutocompleteHandler; + Program.HandleFailure(); } + + throw new Exception("Initialization failed."); } }