diff options
Diffstat (limited to 'src/TrainerMod/Framework/Commands/Player/AddWallpaperCommand.cs')
-rw-r--r-- | src/TrainerMod/Framework/Commands/Player/AddWallpaperCommand.cs | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/TrainerMod/Framework/Commands/Player/AddWallpaperCommand.cs b/src/TrainerMod/Framework/Commands/Player/AddWallpaperCommand.cs index e02b05a4..dddb9ffd 100644 --- a/src/TrainerMod/Framework/Commands/Player/AddWallpaperCommand.cs +++ b/src/TrainerMod/Framework/Commands/Player/AddWallpaperCommand.cs @@ -1,5 +1,4 @@ -using System.Linq; -using StardewModdingAPI; +using StardewModdingAPI; using StardewValley; using StardewValley.Objects; @@ -19,24 +18,11 @@ namespace TrainerMod.Framework.Commands.Player /// <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 - if (!args.Any()) - { - this.LogArgumentsInvalid(monitor, command); + // parse arguments + if (!args.TryGetInt(0, "wallpaper ID", out int wallpaperID, min: 0, max: 111)) return; - } - if (!int.TryParse(args[0], out int wallpaperID)) - { - this.LogArgumentNotInt(monitor, command); - return; - } - if (wallpaperID < 0 || wallpaperID > 111) - { - monitor.Log("There is no such wallpaper ID (must be between 0 and 111).", LogLevel.Error); - return; - } // handle Wallpaper wallpaper = new Wallpaper(wallpaperID); |