Skip to content

Commit

Permalink
When parsing numbers, echo the argument name back to the user upon fa…
Browse files Browse the repository at this point in the history
…ilure
  • Loading branch information
Goodlyay committed May 7, 2024
1 parent 52c7079 commit a714639
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MCGalaxy/Commands/CommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static bool GetInt(Player p, string input, string argName, ref int result
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;
Expand All @@ -111,7 +111,7 @@ public static bool GetReal(Player p, string input, string argName, ref float res
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) {
Expand Down

0 comments on commit a714639

Please sign in to comment.