summaryrefslogtreecommitdiff
path: root/src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs')
-rw-r--r--src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs b/src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs
index ee94093f..c4ea3d6f 100644
--- a/src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs
+++ b/src/TrainerMod/Framework/Commands/Player/AddWeaponCommand.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Linq;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Tools;
@@ -20,19 +19,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, "weapon ID", out int weaponID, min: 0))
return;
- }
- if (!int.TryParse(args[0], out int weaponID))
- {
- this.LogUsageError(monitor, "The weapon ID must be an integer.", command);
- return;
- }
// get raw weapon data
if (!Game1.content.Load<Dictionary<int, string>>("Data\\weapons").TryGetValue(weaponID, out string data))