private static void CleanupServer() { Netplay.StopListening(); try { Netplay.ClosePort(Netplay.ListenPort); } catch { } for (int index = 0; index < 256; ++index) { Netplay.Clients[index].Reset(); } if (Main.menuMode != 15) { Main.netMode = 0; Main.menuMode = 10; WorldFile.SaveWorld(); Main.menuMode = 0; } else { Main.netMode = 0; } Main.myPlayer = 0; }