Unregistering of Events

Discussion in 'Bukkit Preview' started by SpaceManiac, Feb 18, 2012.

  1. Offline

    SpaceManiac

    For those of you who want a little finer-grained control over events, now you have the ability to unregister event listeners by Plugin or by Listener, either globally or for a specific event, with these methods in HandlerList:
    Code:
    public static void unregisterAll(Plugin plugin) // already existed
    public static void unregisterAll(Listener listener) // added
     
    public void unregister(Plugin plugin) // made public
    public void unregister(Listener listener) // added
    
    Some example usage:
    Code:
    HandlerList.unregisterAll(listener); // unregister listener from any events it is registered for
    PlayerMoveEvent.getHandlerList().unregister(plugin); // unregister listeners owned by plugin from PlayerMoveEvent
    
    This bleeding branch also added some missing Javadocs.
     

Share This Page