summaryrefslogtreecommitdiff
path: root/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/TrainerMod/Framework/Commands/World/SetDayCommand.cs')
-rw-r--r--src/TrainerMod/Framework/Commands/World/SetDayCommand.cs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs b/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs
index e47b76a7..54267384 100644
--- a/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs
+++ b/src/TrainerMod/Framework/Commands/World/SetDayCommand.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 date is {Game1.currentSeason} {Game1.dayOfMonth}. Specify a value to change the day.", LogLevel.Info);
return;
}
- if (!int.TryParse(args[0], out int day))
- {
- this.LogArgumentNotInt(monitor, command);
- return;
- }
- if (day > 28 || day <= 0)
- {
- this.LogUsageError(monitor, "That isn't a valid day.", command);
+
+ // parse arguments
+ if (!args.TryGetInt(0, "day", out int day, min: 1, max: 28))
return;
- }
// handle
Game1.dayOfMonth = day;