fix: isolate queued restart settings

This commit is contained in:
Anon 2026-07-26 01:16:07 +02:00
parent 1686d00f30
commit 9b90b535d8
5 changed files with 99 additions and 21 deletions

View file

@ -923,10 +923,15 @@ namespace MinecraftClient
if (delay < TimeSpan.Zero)
delay = TimeSpan.Zero;
RestartSettingsSnapshot? settingsSnapshot = keepAccountAndServerSettings
? new RestartSettingsSnapshot(InternalConfig.Account, InternalConfig.ServerIP, InternalConfig.ServerPort)
: null;
return restartCoordinator.TrySchedule(new RestartRequest(
Volatile.Read(ref connectionAttempt),
delay,
keepAccountAndServerSettings));
keepAccountAndServerSettings,
settingsSnapshot));
}
private static async Task ExecuteRestartAsync(RestartRequest request, CancellationToken cancellationToken)
@ -951,6 +956,12 @@ namespace MinecraftClient
cancellationToken.ThrowIfCancellationRequested();
ConsoleIO.WriteLine(Translations.mcc_restart);
ReloadSettings(request.KeepAccountAndServerSettings);
if (request.SettingsSnapshot is RestartSettingsSnapshot settingsSnapshot)
{
InternalConfig.Account = settingsSnapshot.Account;
InternalConfig.ServerIP = settingsSnapshot.ServerIP;
InternalConfig.ServerPort = settingsSnapshot.ServerPort;
}
InitializeClient();
}