From cd00e620c3d2994b33811f4477c855986e45a16e Mon Sep 17 00:00:00 2001 From: zontreck Date: Fri, 7 Mar 2025 01:44:27 -0700 Subject: [PATCH] Begin to add the admin bypass cooldown option --- AriasServerUtils/ASUModSystem.cs | 8 ++++++++ AriasServerUtils/EventHandler.cs | 12 ++++++++++++ AriasServerUtils/Globals.cs | 3 ++- AriasServerUtils/modinfo.json | 4 ++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/AriasServerUtils/ASUModSystem.cs b/AriasServerUtils/ASUModSystem.cs index c688363..b37da69 100644 --- a/AriasServerUtils/ASUModSystem.cs +++ b/AriasServerUtils/ASUModSystem.cs @@ -124,6 +124,14 @@ namespace AriasServerUtils .WithDescription("DANGER: This updates the flag allowing anybody to create warps, even non-admins. It is recommended to leave this alone. The default is true/on/yes") .HandleWith(Events.HandleUpdateASUMgrWarps) .EndSubCommand() + .BeginSubCommand("adminBypassCooldown") + .RequiresPrivilege(Privilege.controlserver) + .WithArgs( + parsers.Bool("bypass") + ) + .WithDescription("This flag controls whether admins can or can not bypass the cooldown system") + .HandleWith(Events.HandleUpdateASUBypassCD) + .EndSubCommand() .BeginSubCommand("maxback") .RequiresPrivilege(Privilege.controlserver) .WithArgs( diff --git a/AriasServerUtils/EventHandler.cs b/AriasServerUtils/EventHandler.cs index 134c08d..05da76e 100644 --- a/AriasServerUtils/EventHandler.cs +++ b/AriasServerUtils/EventHandler.cs @@ -555,5 +555,17 @@ namespace AriasServerUtils return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:config-value-reset")); } + + internal static TextCommandResult HandleUpdateASUBypassCD(TextCommandCallingArgs args) + { + if (args[0] is bool bypass) + { + // Update the bypass + ServerUtilities.config.AdminsBypassCooldowns = bypass; + ServerUtilities.MarkDirty(); + return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig")); + } + else return TextCommandResult.Success(); + } } } \ No newline at end of file diff --git a/AriasServerUtils/Globals.cs b/AriasServerUtils/Globals.cs index 1b8af8c..cd10039 100644 --- a/AriasServerUtils/Globals.cs +++ b/AriasServerUtils/Globals.cs @@ -22,13 +22,14 @@ namespace AriasServerUtils { CooldownType.RTP, "30s" }, { CooldownType.Back, "5s" } }; - private static readonly int CURRENT_VERSION = 3; + private static readonly int CURRENT_VERSION = 4; public int Version { get; set; } = 0; public int MaxHomes { get; set; } = 20; public bool AdminsBypassMaxHomes { get; set; } = true; public bool onlyAdminsCreateWarps { get; set; } = true; + public bool AdminsBypassCooldowns { get; set; } = true; public int MaxBackCache { get; set; } = 10; public int PlayerSleepingPercentage { get; set; } = 50; public int MaxRTPBlockDistance { get; set; } = 5000; diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index 2036aac..ea0a11d 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: 03-07-2025 @ 1:28 AM MST", - "version": "1.0.5", + "description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 1:44 AM MST", + "version": "1.0.6-dev.1", "dependencies": { "game": "" }