Make max distance arg optional

This commit is contained in:
zontreck 2025-03-07 01:16:03 -07:00
parent a9150cf322
commit 9f7edc64c3
3 changed files with 4 additions and 3 deletions

View file

@ -210,7 +210,7 @@ namespace AriasServerUtils
api.ChatCommands.Create("back").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Returns you to the last location you were at").HandleWith(Events.HandleBack); api.ChatCommands.Create("back").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Returns you to the last location you were at").HandleWith(Events.HandleBack);
api.ChatCommands.Create("rtp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithArgs(parsers.Int("maxDist")).WithDescription("Seeks a position possibly thousands of blocks away to teleport to.").HandleWith(Events.HandleRTP); api.ChatCommands.Create("rtp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithArgs(parsers.OptionalInt("maxDist", defaultValue: -1)).WithDescription("Seeks a position possibly thousands of blocks away to teleport to.").HandleWith(Events.HandleRTP);
} }
private void OnCheckPlayerCooldowns() private void OnCheckPlayerCooldowns()

View file

@ -57,6 +57,7 @@ namespace AriasServerUtils
int maxDistance = ServerUtilities.config.MaxRTPBlockDistance; int maxDistance = ServerUtilities.config.MaxRTPBlockDistance;
if (args[0] is int ix) if (args[0] is int ix)
{ {
if (ix == -1) ix = maxDistance;
if (ix > maxDistance) if (ix > maxDistance)
{ {
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:rtp-capped", ix, maxDistance)); ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:rtp-capped", ix, maxDistance));

View file

@ -3,8 +3,8 @@
"modid": "ariasserverutils", "modid": "ariasserverutils",
"name": "Aria's Server Utilities", "name": "Aria's Server Utilities",
"authors": ["zontreck"], "authors": ["zontreck"],
"description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 00:52 AM MST", "description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 1:15 AM MST",
"version": "1.0.5-dev.1", "version": "1.0.5-dev.2",
"dependencies": { "dependencies": {
"game": "" "game": ""
} }