private void Reboot() { if (_rebooting) { return; } _rebooting = true; WorldTimer tmr = null; var s = 30; Func <World, RealmTime, bool> rebootTick = (w, t) => { s -= 1; if (s == 15) { _manager.Chat.Announce("Server rebooting in 15 seconds...", true); } else if (s == 5) { _manager.Chat.Announce("Server rebooting in 5 seconds...", true); } else if (s == 0) { // this could help avoid unfinished transactions when rebooting foreach (var world in _manager.Worlds.Values) { world.Closed = true; foreach (var p in world.Players.Values) { p.Client?.Disconnect(); } } Program.Stop(); return(true); } tmr.Reset(); return(false); }; tmr = new WorldTimer(1000, rebootTick); _manager.Chat.Announce("Server rebooting in 30 seconds...", true); _manager.GetWorld(World.Realm).Timers.Add(tmr); }