Exemple #1
0
 private void OnPluginCommandRemoved(CommandRemovedEventArgs e)
 {
     foreach (EventListener v in Plugins)
     {
         PluginListener pl = (PluginListener)v.Listener;
         if (v.Event == Event.CommandRemoved)
         {
             pl.OnPluginCommandRemoved(e);
         }
     }
 }
Exemple #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)
        {
            Server server = plugin.Server as Server;
            //Event
            CommandRemovedEventArgs e = new CommandRemovedEventArgs(plugin, cmd);

            CallEvent(Event.CommandAdded, e);
            if (e.EventCanceled)
            {
                return;
            }
            //End Event

            if (PluginCommands.ContainsKey(cmd))
            {
                IPlugin pluginFound;
                PluginCommands.TryGetValue(cmd, out pluginFound);
                if (plugin != pluginFound)
                {
                    return;
                }
                PluginCommands.Remove(cmd);
            }
            try
            {
                if (cmd is IClientCommand)
                {
                    server.ClientCommandHandler.UnregisterCommand(cmd);
                }
                else if (cmd is IServerCommand)
                {
                    server.ServerCommandHandler.UnregisterCommand(cmd);
                }
            }
            catch (CommandNotFoundException ex) { server.Logger.Log(ex); }
        }
Exemple #3
0
 public virtual void OnPluginCommandRemoved(CommandRemovedEventArgs e)
 {
 }