Merge remote-tracking branch 'origin/master' into brigadier-dev

This commit is contained in:
BruceChen 2022-11-07 15:39:46 +08:00
commit 5d2589b10f
185 changed files with 14563 additions and 90684 deletions

View file

@ -247,12 +247,12 @@ namespace MinecraftClient
/// </summary>
/// <param name="extraAttempts">If connection fails, the client will make X extra attempts</param>
/// <param name="delaySeconds">Optional delay, in seconds, before restarting</param>
new public void ReconnectToTheServer(int extraAttempts = -999999, int delaySeconds = 0)
new public void ReconnectToTheServer(int extraAttempts = -999999, int delaySeconds = 0, bool keepAccountAndServerSettings = false)
{
if (extraAttempts == -999999)
base.ReconnectToTheServer();
base.ReconnectToTheServer(delaySeconds: delaySeconds, keepAccountAndServerSettings: keepAccountAndServerSettings);
else
base.ReconnectToTheServer(extraAttempts);
base.ReconnectToTheServer(extraAttempts, delaySeconds, keepAccountAndServerSettings);
}
/// <summary>
@ -361,7 +361,7 @@ namespace MinecraftClient
{
bool result = Settings.Config.Main.Advanced.SetAccount(accountAlias);
if (result && andReconnect)
ReconnectToTheServer();
ReconnectToTheServer(keepAccountAndServerSettings: true);
return result;
}
@ -374,7 +374,7 @@ namespace MinecraftClient
{
bool result = Settings.Config.Main.SetServerIP(new MainConfigHealper.MainConfig.ServerInfoConfig(server), true);
if (result && andReconnect)
ReconnectToTheServer();
ReconnectToTheServer(keepAccountAndServerSettings: true);
return result;
}

View file

@ -922,7 +922,7 @@ namespace MinecraftClient
/// </summary>
/// <param name="ExtraAttempts">In case of failure, maximum extra attempts before aborting</param>
/// <param name="delaySeconds">Optional delay, in seconds, before restarting</param>
protected void ReconnectToTheServer(int ExtraAttempts = 3, int delaySeconds = 0)
protected void ReconnectToTheServer(int ExtraAttempts = 3, int delaySeconds = 0, bool keepAccountAndServerSettings = false)
{
if (Settings.Config.Logging.DebugMessages)
{
@ -930,7 +930,7 @@ namespace MinecraftClient
ConsoleIO.WriteLogLine(string.Format(Translations.chatbot_reconnect, botName));
}
McClient.ReconnectionAttemptsLeft = ExtraAttempts;
Program.Restart(delaySeconds);
Program.Restart(delaySeconds, keepAccountAndServerSettings);
}
/// <summary>