Esempio n. 1
0
 public void RegisterEvent(EventListener listener)
 {
     plugins.Add(listener);
 }
Esempio n. 2
0
 /// <summary>
 /// Unsubscribes from an event.
 /// </summary>
 /// <param name="Listener">The EventListener to associate the event calls with.</param>
 public void UnregisterEvent(EventListener Listener)
 {
     try
     {
         PluginHooks.Find(Listener.Event).Plugins.Remove(Listener);
     }
     catch (EventNotFoundException e)
     {
         //Use the plugin's Chraft.Server to log the error.
         Listener.Plugin.Server.Logger.Log(e);
     }
     catch (Exception) { }
 }
Esempio n. 3
0
 /// <summary>
 /// Unregisters an Array of EventListener.
 /// </summary>
 /// <param name="Listeners">The Array of EventListener.</param>
 public void UnregisterEvents(EventListener[] Listeners)
 {
     foreach (EventListener el in Listeners)
     {
         UnregisterEvent(el);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Subscribes to an event.
 /// </summary>
 /// <param name="Event">The name of the event to listen for.</param>
 /// <param name="Listener">The listener to notify.</param>
 /// <param name="Plugin">The plugin to associate the listener with.</param>
 /// <returns>The resaulting EventListener</returns>
 public EventListener RegisterEvent(Event Event, IChraftListener Listener, IPlugin Plugin)
 {
     EventListener el = new EventListener(Listener, Plugin, Event);
     RegisterEvent(el);
     return el;
 }