public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { if (ChatArguments.Length == 1) { if (ChatArguments[0] == "urgent") { Fougerite.Hooks.IsShuttingDown = true; Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Server Shutdown NOW!"); //UnityEngine.Application.Quit(); Process.GetCurrentProcess().Kill(); } else if (ChatArguments[0] == "safeurgent") { Fougerite.Hooks.IsShuttingDown = true; Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Saving Server..."); AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); Helper.CreateSaves(); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Saved Server Data!"); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Server is shutting down in " + ShutdownTime + " seconds."); _timer = new Timer(TriggerTime * 1000); _timer.Elapsed += Trigger; _timer.Start(); } return; } StartShutdown(); }
public static void savealldata() { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); Helper.CreateSaves(); DataStore.GetInstance().Save(); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { AvatarSaveProc.SaveAll(); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Saved ALL Avatar files!"); ServerSaveManager.AutoSave(); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Saved server global state!"); Helper.CreateSaves(); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Saved " + Core.Name + " data!"); }
public static void savealldata() { try { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); } catch {} }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; AvatarSaveProc.SaveAll(); pl.MessageFrom(Core.Name, "Saved ALL Avatar files!"); ServerSaveManager.AutoSave(); pl.MessageFrom(Core.Name, "Saved server global state!"); Helper.CreateSaves(); pl.MessageFrom(Core.Name, "Saved " + Core.Name + " data!"); }
public static void shutdown_tick() { if (time == 0) { API.sayAll("Server Shutdown NOW!"); AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); } else { API.sayAll("Server Shutting down in " + time + " seconds"); } time -= 10; }
public static void EventServerRestart(EventTimer sender, int ShutdownTime, ref int Timeleft) { if (Timeleft != 0) { if (Timeleft <= 5) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillRestart", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 1f); } else if (Timeleft == 10) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillRestart", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 5f); } else if (Timeleft == 30) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillRestart", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 10f); } else if (Timeleft == 60) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillRestart", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 10f); } else if (Timeleft == ShutdownTime) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.Restart", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 10f); } } if (Timeleft > 0) { Timeleft--; } else { try { if (sender != null) { sender.Stop(); } AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); string text = Environment.GetCommandLineArgs()[0]; string arguments = string.Join(" ", Environment.GetCommandLineArgs()).Replace(text, "").Trim(); Process.Start(text, arguments); Process.GetCurrentProcess().Kill(); } catch (Exception ex) { Helper.LogError(ex.ToString(), true); } } }
public static void savealldata() { try { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); Helper.CreateSaves(); DataStore.GetInstance().Save(); } catch (Exception ex) { Logger.LogException(ex); Logger.Log("Error while auto-saving!"); } }
public static void EventServerShutdown(EventTimer sender, int ShutdownTime, ref int Timeleft) { if (Timeleft != 0) { if (Timeleft <= 5) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillShutdown", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 1f); } else if (Timeleft == 10) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillShutdown", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 5f); } else if (Timeleft == 30) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillShutdown", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 10f); } else if (Timeleft == 60) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.WillShutdown", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 10f); } else if (Timeleft == ShutdownTime) { Broadcast.NoticeAll("☢", Config.GetMessage("Server.Shutdown", null, null).Replace("%SECONDS%", Timeleft.ToString()), null, 10f); } } if (Timeleft > 0) { Timeleft--; } else { try { if (sender != null) { sender.Stop(); } AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); Process.GetCurrentProcess().Kill(); } catch (Exception ex) { Helper.LogError(ex.ToString(), true); } } }
internal static void Trigger(object sender, ElapsedEventArgs elapsedEventArgs) { Time += TriggerTime; if (Time >= ShutdownTime) { _timer.Dispose(); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Saving Server..."); AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); Helper.CreateSaves(); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Saved Server Data!"); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Server shutdown in 5 seconds!"); _timer2 = new Timer(5000); _timer2.Elapsed += Trigger2; _timer2.Start(); } else { Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "Server is shutting down in " + (ShutdownTime - Time) + " seconds."); } }
public static void shutdown_tick() { if (time == 0) { Util.sayAll(Core.Name, "Server Shutdown NOW!"); try { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); Helper.CreateSaves(); DataStore.GetInstance().Save(); } catch (Exception ex) { Logger.LogException(ex); } Process.GetCurrentProcess().Kill(); } else { Util.sayAll(Core.Name, "Server Shutting down in " + time + " seconds"); } time -= 10; }
internal static void Trigger(object sender, ElapsedEventArgs elapsedEventArgs) { Time += TriggerTime; string cyan = "[color #00FFFF]"; string green = "[color #00FF00]"; string yellow = "[color #FFFF00]"; string white = "[color #FFFFFF]"; if (Time >= ShutdownTime) { _timer.Dispose(); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, yellow + "☢ " + green + "Saving all server files..."); ServerSaveManager.AutoSave(); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, yellow + "☢ " + green + "Saved all server files!"); Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "☢ Server is shutting down in: " + cyan + "15" + white + " seconds."); _timer2 = new Timer(15000); _timer2.Elapsed += Trigger2; _timer2.Start(); } else { Fougerite.Server.GetServer().BroadcastFrom(Core.Name, "☢ Server is shutting down in: " + cyan + (ShutdownTime - Time) + white + " seconds."); } }
/// <summary> /// Saves the server and any related information /// </summary> public void Save() => ServerSaveManager.AutoSave();
public void Save() { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); }
public static bool ConsoleReceived(ref ConsoleSystem.Arg a) { StringComparison ic = StringComparison.InvariantCultureIgnoreCase; bool external = a.argUser == null; bool adminRights = (a.argUser != null && a.argUser.admin) || external; string userid = "[external][external]"; if (adminRights && !external) { userid = string.Format("[{0}][{1}]", a.argUser.displayName, a.argUser.userID.ToString()); } string logmsg = string.Format("[ConsoleReceived] userid={0} adminRights={1} command={2}.{3} args={4}", userid, adminRights.ToString(), a.Class, a.Function, (a.HasArgs(1) ? a.ArgsStr : "none")); Logger.LogDebug(logmsg); if (a.Class.Equals("fougerite", ic) && a.Function.Equals("reload", ic)) { if (adminRights) { ModuleManager.ReloadModules(); a.ReplyWith("Fougerite: Reloaded!"); } } else if (a.Class.Equals("fougerite", ic) && a.Function.Equals("save", ic)) { AvatarSaveProc.SaveAll(); ServerSaveManager.AutoSave(); if (Fougerite.Server.GetServer().HasRustPP) { Fougerite.Server.GetServer().GetRustPPAPI().RustPPSave(); } DataStore.GetInstance().Save(); a.ReplyWith("Fougerite: Saved!"); } else if (a.Class.Equals("fougerite", ic) && a.Function.Equals("rustpp", ic)) { foreach (var module in Fougerite.ModuleManager.Modules) { if (module.Plugin.Name.Equals("RustPPModule")) { module.DeInitialize(); module.Initialize(); break; } } a.ReplyWith("Rust++ Reloaded!"); } else if (OnConsoleReceived != null) { OnConsoleReceived(ref a, external); } if (string.IsNullOrEmpty(a.Reply)) { a.ReplyWith(string.Format("Fougerite: {0}.{1} was executed!", a.Class, a.Function)); } return(true); }