Backup bots before unloading on transfer initiation

Added logic to backup current bots before unloading during transfer.
This commit is contained in:
xiaoze_qwq_ 2026-08-27 12:25:54 +08:00 committed by GitHub
parent 6a5b28b0bd
commit 92ee61b3ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();