### Summary - Fixes `[AdvancedSearch` being accessible by players 😱 - Adds `[GenCommands` to generate the same commands html page on https://muo.gg/commands. - Fixes `[helpinfo` so all commands properly show up! > [!WARNING] > ### Developer Warning: > Commands must now be registered in the `Configure` bootup phase. > If a command is not registered early enough, it may not be available to systems like [helpinfo > that cache their information. > [!NOTE] > ### Developer Note: > Various commands related to generating content have been changed to _Developer_ and above access level. ### Screenshots <img width="673" alt="image" src="https://github.com/modernuo/ModernUO/assets/3953314/b105b5c9-5eb4-4ace-93ff-1bfb31e7132f"> <img width="547" alt="image" src="https://github.com/modernuo/ModernUO/assets/3953314/e97487e8-47a5-4aa7-89cc-9fe3deda584d">
68 lines
2.4 KiB
C#
68 lines
2.4 KiB
C#
using Server.Saves;
|
|
|
|
namespace Server.Commands
|
|
{
|
|
public static class SaveCommands
|
|
{
|
|
public static void Configure()
|
|
{
|
|
CommandSystem.Register("Save", AccessLevel.Administrator, Save_OnCommand);
|
|
CommandSystem.Register("SetSaves", AccessLevel.Administrator, SetAutoSaves_OnCommand);
|
|
CommandSystem.Register("AutoSave", AccessLevel.Administrator, SetAutoSaves_OnCommand);
|
|
CommandSystem.Register("SaveFrequency", AccessLevel.Administrator, SetSaveFrequency_OnCommand);
|
|
CommandSystem.Register("PruneArchives", AccessLevel.Administrator, PruneArchives_OnCommand);
|
|
}
|
|
|
|
[Usage("PruneArchives"), Description("Prunes archives folder.")]
|
|
private static void PruneArchives_OnCommand(CommandEventArgs e)
|
|
{
|
|
AutoArchive.PruneBackups();
|
|
}
|
|
|
|
[Usage("Save"), Description("Saves the world.")]
|
|
private static void Save_OnCommand(CommandEventArgs e)
|
|
{
|
|
AutoSave.Save();
|
|
}
|
|
|
|
[Usage("AutoSave <on | off>"), Description("Enables or disables automatic shard saving.")]
|
|
public static void SetAutoSaves_OnCommand(CommandEventArgs e)
|
|
{
|
|
if (e.Length == 1)
|
|
{
|
|
|
|
var enabled = AutoSave.SavesEnabled = e.GetBoolean(0);
|
|
|
|
if (enabled)
|
|
{
|
|
e.Mobile.SendMessage($"Saves have been enabled.");
|
|
}
|
|
else
|
|
{
|
|
e.Mobile.SendMessage($"Saves have been disabled.");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
e.Mobile.SendMessage("Format: AutoSave <on | off>");
|
|
}
|
|
}
|
|
|
|
[Usage("SaveFrequency <duration> [warning duration]"), Description("Sets the save frequency starting at midnight local to the server.")]
|
|
public static void SetSaveFrequency_OnCommand(CommandEventArgs e)
|
|
{
|
|
if (e.Length < 1)
|
|
{
|
|
e.Mobile.SendMessage("Format: SaveFrequency <duration> [warning duration]");
|
|
return;
|
|
}
|
|
|
|
var saveDelay = e.GetTimeSpan(0);
|
|
var warningDelay = e.Length >= 2 ? e.GetTimeSpan(1) : AutoSave.Warning;
|
|
|
|
AutoSave.ResetAutoSave(saveDelay, warningDelay);
|
|
|
|
e.Mobile.SendMessage("Save frequency has been updated.");
|
|
}
|
|
}
|
|
}
|