Changes before error encountered

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/3835076c-7b39-4839-a923-4c9463cc8737
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 20:55:01 +00:00
parent 24e1f32bb8
commit 63c4750378
2 changed files with 14 additions and 2 deletions

View file

@ -57,6 +57,7 @@ namespace MinecraftClient.Commands
private static int DownloadUpdate(CmdResult r, bool force)
{
Program.SetUpgradeCommandUsed();
if (UpgradeHelper.DownloadLatestBuild(force))
return r.SetAndReturn(CmdResult.Status.Done, Translations.mcc_update_start);
else

View file

@ -53,6 +53,7 @@ namespace MinecraftClient
private static IDisposable? _sentrySdk = null;
private static bool useMcVersionOnce = false;
private static string settingsIniPath = "MinecraftClient.ini";
private static bool upgradeCommandUsed = false;
// [SENTRY]
// Setting this string to an empty string will disable Sentry
@ -708,12 +709,21 @@ namespace MinecraftClient
ConsoleIO.WriteLine(string.Format(Translations.config_load, settingsIniPath));
}
/// <summary>
/// Prevents the settings file from being saved. Called when the /upgrade command is used.
/// </summary>
public static void SetUpgradeCommandUsed()
{
upgradeCommandUsed = true;
}
/// <summary>
/// Write-back settings
/// </summary>
public static void WriteBackSettings(bool enableBackup = true)
{
Settings.WriteToFile(settingsIniPath, enableBackup);
if (!upgradeCommandUsed)
Settings.WriteToFile(settingsIniPath, enableBackup);
}
/// <summary>
@ -743,7 +753,8 @@ namespace MinecraftClient
{
WriteBackSettings();
ConsoleInteractive.ConsoleSuggestion.ClearSuggestions();
ConsoleIO.WriteLineFormatted("§a" + string.Format(Translations.config_saving, settingsIniPath));
if (!upgradeCommandUsed)
ConsoleIO.WriteLineFormatted("§a" + string.Format(Translations.config_saving, settingsIniPath));
if (client is not null) { client.Disconnect(); ConsoleIO.Reset(); }
if (offlinePrompt is not null) { offlinePrompt.Item2.Cancel(); offlinePrompt.Item1.Join(); offlinePrompt = null; ConsoleIO.Reset(); }