예제 #1
0
 public virtual void OnPluginCommandRemoved(CommandRemovedEventArgs e)
 {
 }
예제 #2
0
        /// <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); }
        }
예제 #3
0
 private void OnPluginCommandRemoved(CommandRemovedEventArgs e)
 {
     foreach (EventListener v in Plugins)
     {
         PluginListener pl = (PluginListener)v.Listener;
         if (v.Event == Event.CommandRemoved)
             pl.OnPluginCommandRemoved(e);
     }
 }