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); } } } }
//Name = "Lost City Spawn Point"; public static void Start() { Threads.Run("Spawn Thunder and Banned", Run); }