private static void Run() { while (Program.Active) { TcpListener listener = new TcpListener(IPAddress.Loopback, port); try { listener.Start(); while (Program.Active) { Console.WriteLine("Listening for controller on " + port); TcpClient client = listener.AcceptTcpClient(); if (Program.Active == false) { return; } Console.WriteLine("New controller connected"); ControllerThread ct = new ControllerThread(client); controllerThreads.Add(ct); Threads.Run("Controller Client", ct.Run); Console.WriteLine("Controller thread started"); } } catch (ThreadInterruptedException) { Console.WriteLine("ControlListener stoped"); #if !DEBUG } catch (Exception e) { Log.WriteServer(e); Thread.Sleep(5000); #endif } finally { try { listener.Stop(); } catch (Exception e) { Log.WriteServer(e); } } } }
public static void RunUpdater(object unusedTimerState) { try { if (Program.Active == false) { updater.Dispose(); return; } //Debug.WriteLine("Player list Updater Thread Run"); #if !DEBUG Threads.WatchdogCheck(); #endif //Update external replies UpdateServerListPingReply(); UpdateTabPlayers(); } catch (Exception e) { Log.WriteServer(e); } try { //Write player count int rp = World.Main.Players.Length; int op = List.Length - rp; File.WriteAllText("playercount", MinecraftServer.MaxSlots + "\n" + rp + "\n" + op); } catch // (Exception e) { //Log.WriteServer(e); } }
public static void Start() { thread = Threads.Create("Backup", BackupThreadRun, null); thread.Start(); }
public static void Run(object o, Action run) { Threads t = Create(o, run, null); t.Start(); }
//Name = "Lost City Spawn Point"; public static void Start() { Threads.Run("Spawn Thunder and Banned", Run); }
ServerCommander() { thread = Threads.Create(this, Run, null); }