Un-Registering Event Listeners

Discussion in 'Plugin Development' started by geekygenius, Feb 19, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    geekygenius

    So, I used to be quite familiar with the way Bukkit events were handled, but now, with the new update, I am not. I was wondering if it were still possible to un-register event listeners, without reloading the plugin, and registering all the event listeners except the one you want to unregister.

    Thanks!
     
  2. Offline

    ronix

    No, it is not possible. The method I use it to implement a "event catcher" class that delegates events to other classes as needed. This makes it possible to change your plugin settings on the fly without the need to unregister events.
     
  3. Offline

    Technius

    Code:java
    1. for(HandlerList l:HandlerList.getHandlerLists())
    2. {
    3. l.unregister(plugin);//make sure you have a plugin variable
    4. }
     
  4. Offline

    stelar7

  5. Offline

    geekygenius

    Thanks stelar and Technius, it looks like the method calls in the HandlerList object should work for what I need. I saw
    Code:
    public static HandlerList.unregisterAll()
    which looks like a major security error, because it can unregister all the event listeners across all plugins.
     
Thread Status:
Not open for further replies.

Share This Page