Exemple #1
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, ChraftListener Listener, IPlugin Plugin)
 {
     EventListener el = new EventListener(Listener, Plugin, Event);
     RegisterEvent(el);
     return el;
 }
Exemple #2
0
 /// <summary>
 /// Unsubscribes from an event.
 /// </summary>
 /// <param name="Event">The name of the event.</param>
 /// <param name="Listener">The listener.</param>
 /// <param name="Plugin">The plugin associated with the listener.</param>
 public void UnregisterEvent(Event Event, ChraftListener Listener, IPlugin Plugin)
 {
     foreach (EventListener el in PluginHooks.Find(Event).Plugins)
     {
         if (el.Event == Event && el.Listener == Listener && el.Plugin == Plugin)
         {
             UnregisterEvent(el);
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// initializes a new instance of the EventListener struct.
 /// </summary>
 /// <param name="Listener">A valid Listener.  
 /// All Listeners are in the Chraft.Plugins.Listener namespace.</param>
 /// <param name="Plugin">The IPlugin that the listener is attached to.</param>
 /// <param name="Event">The name of the event to listen for.</param>
 public EventListener(ChraftListener Listener, IPlugin Plugin, Event Event)
 {
     this.Listener = Listener;
     this.Event = Event;
     this.Plugin = Plugin;
 }