From 023b17a68e70cf310d0fcf62cd8515f41745f390 Mon Sep 17 00:00:00 2001 From: Taryn Hill Date: Tue, 28 Jun 2016 20:46:05 -0500 Subject: [PATCH] Allow overriding previously registered chatcommands --- OpenRA.Mods.Common/Commands/ChatCommands.cs | 3 ++- OpenRA.Mods.Common/Commands/HelpCommand.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Commands/ChatCommands.cs b/OpenRA.Mods.Common/Commands/ChatCommands.cs index 9d33820e50..0bf53e247b 100644 --- a/OpenRA.Mods.Common/Commands/ChatCommands.cs +++ b/OpenRA.Mods.Common/Commands/ChatCommands.cs @@ -48,7 +48,8 @@ namespace OpenRA.Mods.Common.Commands public void RegisterCommand(string name, IChatCommand command) { - Commands.Add(name.ToLowerInvariant(), command); + // Override possible duplicates instead of crashing. + Commands[name.ToLowerInvariant()] = command; } } diff --git a/OpenRA.Mods.Common/Commands/HelpCommand.cs b/OpenRA.Mods.Common/Commands/HelpCommand.cs index e920f92f23..6da5e6071a 100644 --- a/OpenRA.Mods.Common/Commands/HelpCommand.cs +++ b/OpenRA.Mods.Common/Commands/HelpCommand.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Commands public void RegisterHelp(string name, string description) { - helpDescriptions.Add(name, description); + helpDescriptions[name] = description; } } } \ No newline at end of file