diff options
Diffstat (limited to 'src/TrainerMod/Framework/Commands/World/SetYearCommand.cs')
-rw-r--r-- | src/TrainerMod/Framework/Commands/World/SetYearCommand.cs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs b/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs index 6b2b0d93..760fc170 100644 --- a/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs +++ b/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs @@ -18,24 +18,18 @@ namespace TrainerMod.Framework.Commands.World /// <param name="monitor">Writes messages to the console and log file.</param> /// <param name="command">The command name.</param> /// <param name="args">The command arguments.</param> - public override void Handle(IMonitor monitor, string command, string[] args) + public override void Handle(IMonitor monitor, string command, ArgumentParser args) { - // validate + // no-argument mode if (!args.Any()) { monitor.Log($"The current year is {Game1.year}. Specify a value to change the year.", LogLevel.Info); return; } - if (!int.TryParse(args[0], out int year)) - { - this.LogArgumentNotInt(monitor, command); - return; - } - if (year < 1) - { - this.LogUsageError(monitor, "That isn't a valid year.", command); + + // parse arguments + if (!args.TryGetInt(0, "year", out int year, min: 1)) return; - } // handle Game1.year = year; |