Esempio n. 1
0
 private void OnPluginCommandAdded(CommandAddedEventArgs e)
 {
     foreach (EventListener v in Plugins)
     {
         PluginListener pl = (PluginListener)v.Listener;
         if (v.Event == Event.CommandAdded)
         {
             pl.OnPluginCommandAdded(e);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Registers a command with the server.
        /// </summary>
        /// <param name="cmd">The command to register.  ClientCommand or ServerCommand.</param>
        /// <param name="plugin">The plugin to associate the command with.</param>
        public void RegisterCommand(ICommand cmd, IPlugin plugin)
        {
            Server server = plugin.Server as Server;

            if (cmd is IClientCommand)
            {
                try
                {
                    //Event
                    CommandAddedEventArgs e = new CommandAddedEventArgs(plugin, cmd);
                    CallEvent(Event.CommandAdded, e);
                    if (e.EventCanceled)
                    {
                        return;
                    }
                    //End Event

                    PluginCommands.Add(cmd, plugin);
                    server.ClientCommandHandler.RegisterCommand(cmd);
                }
                catch (CommandAlreadyExistsException e)
                {
                    server.Logger.Log(e);
                }
            }
            else if (cmd is IServerCommand)
            {
                try
                {
                    //Event
                    CommandAddedEventArgs e = new CommandAddedEventArgs(plugin, cmd);
                    CallEvent(Event.CommandAdded, e);
                    if (e.EventCanceled)
                    {
                        return;
                    }
                    //End Event

                    PluginCommands.Add(cmd, plugin);
                    server.ServerCommandHandler.RegisterCommand(cmd);
                }
                catch (CommandAlreadyExistsException e)
                {
                    server.Logger.Log(e);
                }
            }
        }
Esempio n. 3
0
 public virtual void OnPluginCommandAdded(CommandAddedEventArgs e)
 {
 }