Beispiel #1
0
 private void OnPluginDisabled(PluginDisabledEventArgs e)
 {
     foreach (EventListener v in Plugins)
     {
         PluginListener pl = (PluginListener)v.Listener;
         if (v.Event == Event.PluginDisabled)
             pl.OnPluginDisabled(e);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Called to disable a plugin.
        /// 
        /// NOTE: this will NOT unload the assembly OR unlock the plugin DLL.
        /// </summary>
        /// <param name="plugin">The plugin to disable.</param>
        public void DisablePlugin(IPlugin plugin)
        {
            //Event
            PluginDisabledEventArgs args = new PluginDisabledEventArgs(plugin);
            CallEvent(Event.PluginDisabled, args);
            if (args.EventCanceled) return;
            //End Event

            try
            {
                //We call the plugins Dispose sub first incase it has to do 
                //Its own cleanup stuff
                plugin.OnDisabled();
                //Just in case of lazy plugin devs.
                UnregisterEvents(GetRegisterdEvents(plugin));
            }
            catch (Exception e)
            {
                Server.Logger.Log(e);
            }
            lock (Plugins)
                Plugins.Remove(plugin);
        }
Beispiel #3
0
 public virtual void OnPluginDisabled(PluginDisabledEventArgs e) { }