From 92ee61b3ce84ae88f4baa39cbce75874f3c37d94 Mon Sep 17 00:00:00 2001 From: xiaoze_qwq_ <439657748@qq.com> Date: Thu, 27 Aug 2026 12:25:54 +0800 Subject: [PATCH] Backup bots before unloading on transfer initiation Added logic to backup current bots before unloading during transfer. --- MinecraftClient/McClient.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 16c35cca..49a1763d 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -436,6 +436,12 @@ namespace MinecraftClient ResolveTransferAddress(ref resolvedHost, ref resolvedPort); Log.Info($"Initiating a transfer to: {resolvedHost}:{resolvedPort}"); + // Backup current bots before unloading, so they can be restored after successful transfer. + if (botsOnHold.Count == 0 && bots.Count > 0) + { + botsOnHold.AddRange(bots.Where(bot => bot.ScriptOwnerKey is null)); // 保持一致过滤 + } + // Unload bots UnloadAllBots(); bots.Clear();