public virtual void OnPluginCommandRemoved(CommandRemovedEventArgs e) { }
/// <summary> /// Unregisters a command. /// </summary> /// <param name="cmd">The command to unregister.</param> /// <param name="Plugin">The plugin that the command is associated with.</param> public void UnregisterCommand(ICommand cmd, IPlugin Plugin) { //Event CommandRemovedEventArgs e = new CommandRemovedEventArgs(Plugin, cmd); CallEvent(Event.CommandAdded, e); if (e.EventCanceled) return; //End Event if (PluginCommands.ContainsKey(cmd)) { IPlugin plugin; PluginCommands.TryGetValue(cmd, out plugin); if (Plugin != plugin) return; PluginCommands.Remove(cmd); } try { if (cmd is IClientCommand) Plugin.Server.ClientCommandHandler.UnregisterCommand(cmd); else if (cmd is IServerCommand) Plugin.Server.ServerCommandHandler.UnregisterCommand(cmd); } catch (CommandNotFoundException ex) { Plugin.Server.Logger.Log(ex); } }
private void OnPluginCommandRemoved(CommandRemovedEventArgs e) { foreach (EventListener v in Plugins) { PluginListener pl = (PluginListener)v.Listener; if (v.Event == Event.CommandRemoved) pl.OnPluginCommandRemoved(e); } }