From a71463964afd6677b3fe49c102b457924043d8e1 Mon Sep 17 00:00:00 2001 From: Goodlyay Date: Mon, 6 May 2024 22:31:49 -0700 Subject: [PATCH] When parsing numbers, echo the argument name back to the user upon failure --- MCGalaxy/Commands/CommandParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MCGalaxy/Commands/CommandParser.cs b/MCGalaxy/Commands/CommandParser.cs index 754664cdb..c46834ca4 100644 --- a/MCGalaxy/Commands/CommandParser.cs +++ b/MCGalaxy/Commands/CommandParser.cs @@ -99,7 +99,7 @@ namespace MCGalaxy.Commands int min = int.MinValue, int max = int.MaxValue) { int value; if (!NumberUtils.TryParseInt32(input, out value)) { - p.Message("&W\"{0}\" is not a valid integer.", input); return false; + p.Message("&W\"{0}\" is not a valid integer for {1}.", input, argName.ToLowerInvariant()); return false; } if (!CheckRange(p, value, argName, min, max)) return false; @@ -111,7 +111,7 @@ namespace MCGalaxy.Commands float min = float.NegativeInfinity, float max = float.MaxValue) { float value; if (!NumberUtils.TryParseSingle(input, out value)) { - p.Message("&W\"{0}\" is not a valid number.", input); return false; + p.Message("&W\"{0}\" is not a valid number for {1}.", input, argName.ToLowerInvariant()); return false; } if (value < min || value > max) {