Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddCommand< T >()

ChatCommandProcessor Terraria.Chat.ChatCommandProcessor.AddCommand< T > ( )
inline
Type Constraints
T :IChatCommand 
T :new() 

Definition at line 19 of file ChatCommandProcessor.cs.

19 : IChatCommand, new()
20 {
22 string commandKey = "ChatCommand." + cacheableAttribute.Name;
23 ChatCommandId chatCommandId = ChatCommandId.FromType<T>();
24 _commands[chatCommandId] = new T();
26 {
28 }
29 else
30 {
31 commandKey += "_";
32 LocalizedText[] array = Language.FindAll((string key, LocalizedText text) => key.StartsWith(commandKey));
33 foreach (LocalizedText key2 in array)
34 {
36 }
37 }
38 return this;
39 }
void Add(TKey key, TValue value)
readonly Dictionary< ChatCommandId, IChatCommand > _commands
readonly Dictionary< LocalizedText, ChatCommandId > _localizedCommands
static LocalizedText[] FindAll(Regex regex)
Definition Language.cs:55
static LocalizedText GetText(string key)
Definition Language.cs:10
static bool Exists(string key)
Definition Language.cs:45

References Terraria.Chat.ChatCommandProcessor._commands, Terraria.Chat.ChatCommandProcessor._localizedCommands, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), Terraria.Localization.Language.Exists(), Terraria.Localization.Language.FindAll(), and Terraria.Localization.Language.GetText().

Referenced by Terraria.Chat.ChatCommandProcessor.AddDefaultCommand< T >().