Add a command to list cooldown settings and all active command cooldowns for the current player

This commit is contained in:
zontreck 2025-03-07 12:05:04 -07:00
parent c5c605d057
commit 29cf4e21b7
3 changed files with 28 additions and 6 deletions

View file

@ -14,7 +14,7 @@ namespace AriasServerUtils
{
internal static TextCommandResult HandleASU(TextCommandCallingArgs args)
{
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:help", ServerUtilities.config.MaxHomes, ServerUtilities.config.AdminsBypassMaxHomes, ServerUtilities.config.MaxBackCache, string.Join(", ", new string[] { "setspawn", "spawn", "delspawn", "sethome", "home", "delhome", "homes", "restoreinv", "asu", "warp", "setwarp", "delwarp", "warps", "back", "rtp" })));
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:help", ServerUtilities.config.MaxHomes, ServerUtilities.config.AdminsBypassMaxHomes, ServerUtilities.config.MaxBackCache, string.Join(", ", new string[] { "setspawn", "spawn", "delspawn", "sethome", "home", "delhome", "homes", "restoreinv", "asu", "warp", "setwarp", "delwarp", "warps", "back", "rtp", "listcooldowns" })));
}
internal static TextCommandResult HandleBack(TextCommandCallingArgs args)
@ -579,5 +579,25 @@ namespace AriasServerUtils
}
else return TextCommandResult.Success();
}
internal static TextCommandResult HandleListCooldowns(TextCommandCallingArgs args)
{
string sReturn = "SERVER COOLDOWN SETTINGS\n";
foreach (var cd in ServerUtilities.config.Cooldowns)
{
sReturn += $"{cd.Key}: {cd.Value}\n";
}
if (args.Caller.Player is IServerPlayer isp)
{
sReturn += "\nYour active cooldowns:";
foreach (var cd in ServerUtilities.GetPlayerData(isp).ActiveCooldowns)
{
long remain = cd.Value - TimeUtil.GetUnixEpochTimestamp();
string sCDVal = TimeUtil.EncodeTimeNotation(remain);
sReturn += $"{cd.Key}: {sCDVal}\n";
}
}
return TextCommandResult.Success(sReturn);
}
}
}