From 4b5dd0f2c9ed530e97a783aedb3de73425d24516 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 22 Jan 2021 20:29:08 -0500 Subject: rename TrainerCommand to ConsoleCommand to match the rest of the code --- src/SMAPI.Mods.ConsoleCommands/ModEntry.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands/ModEntry.cs') diff --git a/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs b/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs index 5c4f3bba..91437fd3 100644 --- a/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs +++ b/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs @@ -13,13 +13,13 @@ namespace StardewModdingAPI.Mods.ConsoleCommands ** Fields *********/ /// The commands to handle. - private ITrainerCommand[] Commands; + private IConsoleCommand[] Commands; /// The commands which may need to handle update ticks. - private ITrainerCommand[] UpdateHandlers; + private IConsoleCommand[] UpdateHandlers; /// The commands which may need to handle input. - private ITrainerCommand[] InputHandlers; + private IConsoleCommand[] InputHandlers; /********* @@ -31,7 +31,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands { // register commands this.Commands = this.ScanForCommands().ToArray(); - foreach (ITrainerCommand command in this.Commands) + foreach (IConsoleCommand command in this.Commands) helper.ConsoleCommands.Add(command.Name, command.Description, (name, args) => this.HandleCommand(command, name, args)); // cache commands @@ -52,7 +52,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands /// The event arguments. private void OnButtonPressed(object sender, ButtonPressedEventArgs e) { - foreach (ITrainerCommand command in this.InputHandlers) + foreach (IConsoleCommand command in this.InputHandlers) command.OnButtonPressed(this.Monitor, e.Button); } @@ -61,7 +61,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands /// The event arguments. private void OnUpdateTicked(object sender, EventArgs e) { - foreach (ITrainerCommand command in this.UpdateHandlers) + foreach (IConsoleCommand command in this.UpdateHandlers) command.OnUpdated(this.Monitor); } @@ -69,19 +69,19 @@ namespace StardewModdingAPI.Mods.ConsoleCommands /// The command to invoke. /// The command name specified by the user. /// The command arguments. - private void HandleCommand(ITrainerCommand command, string commandName, string[] args) + private void HandleCommand(IConsoleCommand command, string commandName, string[] args) { ArgumentParser argParser = new ArgumentParser(commandName, args, this.Monitor); command.Handle(this.Monitor, commandName, argParser); } /// Find all commands in the assembly. - private IEnumerable ScanForCommands() + private IEnumerable ScanForCommands() { return ( from type in this.GetType().Assembly.GetTypes() - where !type.IsAbstract && typeof(ITrainerCommand).IsAssignableFrom(type) - select (ITrainerCommand)Activator.CreateInstance(type) + where !type.IsAbstract && typeof(IConsoleCommand).IsAssignableFrom(type) + select (IConsoleCommand)Activator.CreateInstance(type) ); } } -- cgit