public virtual void OnPluginEnabled(PluginEnabledEventArgs e) { }
/// <summary> /// Loads a plugin into the PluginManager so that it can be managed by the server. /// </summary> /// <param name="plugin">The plugin to be loaded.</param> public void LoadPlugin(IPlugin plugin) { //Event PluginEnabledEventArgs e = new PluginEnabledEventArgs(plugin); CallEvent(Event.PluginEnabled, e); if (e.EventCanceled) return; //End Event lock (Plugins) Plugins.Add(plugin); try { OnPluginLoaded(plugin); plugin.Associate(Server, this); plugin.Initialize(); plugin.OnEnabled(); } catch (Exception ex) { Server.Logger.Log(Logger.LogLevel.Fatal, plugin.Name + " cannot be loaded. It may be out of date."); Server.Logger.Log(ex); } }
private void OnPluginEnabled(PluginEnabledEventArgs e) { foreach (EventListener v in Plugins) { PluginListener pl = (PluginListener)v.Listener; if (v.Event == Event.PluginEnabled) pl.OnPluginEnabled(e); } }