/// <summary> /// Creates a javascript alias pointing to a javascript function. /// </summary> internal void CreateAlias(JScriptAliasCommand alias, bool allowServer = true) { TShockAPI.Command newCommand = new TShockAPI.Command(alias.Permissions, ChatCommand_AliasExecuted, new string[] { alias.CommandAlias, "jistalias." + alias.CommandAlias }) { AllowServer = allowServer }; newCommand.DoLog = alias.Silent == false; TShockAPI.Commands.ChatCommands.RemoveAll(i => i.Names.Contains("jistalias." + alias.CommandAlias)); TShockAPI.Commands.ChatCommands.Add(newCommand); jsAliases.RemoveAll(i => i.CommandAlias == alias.CommandAlias); jsAliases.Add(alias); }
/// <summary> /// Removes an alias. /// </summary> internal void RemoveAlias(JScriptAliasCommand alias) { jsAliases.RemoveAll(i => i.CommandAlias == alias.CommandAlias); TShockAPI.Commands.ChatCommands.RemoveAll(i => i.Names.Contains("jistalias." + alias.CommandAlias)); }