/// <summary> /// Disconnect the current client from the server and restart it /// </summary> public static void Restart() { new Thread(new ThreadStart(delegate { if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); } if (offlinePrompt != null) { offlinePrompt.Abort(); offlinePrompt = null; ConsoleIO.Reset(); } Console.WriteLine("Restarting Minecraft Console Client..."); InitializeClient(); })).Start(); }
/// <summary> /// Disconnect the current client from the server and restart it /// </summary> /// <param name="delay">Optional delay, in seconds, before restarting</param> public static void Restart(int delaySeconds = 0) { new Thread(new ThreadStart(delegate { if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); } if (offlinePrompt != null) { offlinePrompt.Abort(); offlinePrompt = null; ConsoleIO.Reset(); } if (delaySeconds > 0) { Console.WriteLine("Waiting " + delaySeconds + " seconds before restarting..."); System.Threading.Thread.Sleep(delaySeconds * 1000); } Console.WriteLine("Restarting Minecraft Console Client..."); InitializeClient(); })).Start(); }
/// <summary> /// Disconnect the current client from the server and restart it /// </summary> /// <param name="delaySeconds">Optional delay, in seconds, before restarting</param> public static void Restart(int delaySeconds = 0) { vars.loggedIn = false; new Thread(new ThreadStart(delegate { if (Client != null) { Client.Disconnect(); ConsoleIO.Reset(); } if (offlinePrompt != null) { offlinePrompt.Abort(); offlinePrompt = null; ConsoleIO.Reset(); } if (delaySeconds > 0) { ConsoleIO.WriteLineFormatted("§3[Conexão] §cReconectando o HtBot em " + delaySeconds + " segundos"); System.Threading.Thread.Sleep(delaySeconds * 1000); } //Console.WriteLine("Reconectando o HtBot..."); InitializeClient(); })).Start(); }