diff --git a/AriasServerUtils/ASUModSystem.cs b/AriasServerUtils/ASUModSystem.cs index 48790fa..5856252 100644 --- a/AriasServerUtils/ASUModSystem.cs +++ b/AriasServerUtils/ASUModSystem.cs @@ -85,6 +85,24 @@ namespace AriasServerUtils api.ChatCommands.Create("home").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Teleports you to home").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleGoHome); api.ChatCommands.Create("delhome").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Deletes a home entry").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleDelHome); api.ChatCommands.Create("homes").RequiresPlayer().WithDescription("Lists your homes").RequiresPrivilege(Privilege.controlserver).HandleWith(Events.HandleListHomes); + + api.ChatCommands.Create("asu") + .RequiresPrivilege(Privilege.chat) + .BeginSubCommand("update") + .RequiresPlayer() + .RequiresPrivilege(Privilege.controlserver) + .WithArgs( + parsers.Int("maxHomes"), + parsers.Bool("adminsBypass")) + .HandleWith(Events.HandleUpdateASU) + .WithDescription("Updates the ASU mod configuration") + .EndSubCommand() + .BeginSubCommand("help") + .RequiresPlayer() + .RequiresPrivilege(Privilege.chat) + .HandleWith(Events.HandleASU) + .WithDescription("Lists all Aria's Server Utils commands") + .EndSubCommand(); } private void OnPlayerDC(IServerPlayer byPlayer) diff --git a/AriasServerUtils/EventHandler.cs b/AriasServerUtils/EventHandler.cs index 3688eec..85e03d7 100644 --- a/AriasServerUtils/EventHandler.cs +++ b/AriasServerUtils/EventHandler.cs @@ -10,6 +10,11 @@ namespace AriasServerUtils { public class Events { + internal static TextCommandResult HandleASU(TextCommandCallingArgs args) + { + return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:help", ServerUtilities.config.MaxHomes, ServerUtilities.config.AdminsBypassMaxHomes, string.Join(", ", new string[] { "setspawn", "spawn", "delspawn", "sethome", "home", "delhome", "homes", "restoreinv", "asu" }))); + } + internal static TextCommandResult HandleClearSpawn(TextCommandCallingArgs args) { ServerUtilities.config.Spawn = null; @@ -179,5 +184,26 @@ namespace AriasServerUtils return TextCommandResult.Success(); } + + internal static TextCommandResult HandleUpdateASU(TextCommandCallingArgs args) + { + + if (args[0] is int maxHomes) + { + + ServerUtilities.config.MaxHomes = maxHomes; + if (args[1] is bool bypass) + { + ServerUtilities.config.AdminsBypassMaxHomes = bypass; + } + + ServerUtilities.MarkDirty(); + return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig")); + + } + + return TextCommandResult.Success(); + + } } } \ No newline at end of file diff --git a/AriasServerUtils/assets/ariasserverutils/lang/en.json b/AriasServerUtils/assets/ariasserverutils/lang/en.json index c756cf8..0dc690a 100644 --- a/AriasServerUtils/assets/ariasserverutils/lang/en.json +++ b/AriasServerUtils/assets/ariasserverutils/lang/en.json @@ -16,5 +16,9 @@ "home-max": "You have reached your max number of homes", "home-set": "Home saved", "home-del": "Home deleted", - "home-list": "You have [{0}] home(s)\n\n{1}" + "home-list": "You have [{0}] home(s)\n\n{1}", + + "help": "All Aria's Server Utilities Commands: \n\nMax Homes: {0}; Admins can bypass max homes: {1}\n{2}", + + "updatedconfig": "[ASU] server config updated" } diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index 7b2db8e..72de391 100644 --- a/AriasServerUtils/modinfo.json +++ b/AriasServerUtils/modinfo.json @@ -3,8 +3,8 @@ "modid": "ariasserverutils", "name": "Aria's Server Utilities", "authors": ["zontreck"], - "description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:43 PM", - "version": "1.0.0-dev.9", + "description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:46 PM", + "version": "1.0.0-dev.10", "dependencies": { "game": "" }