Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to unregister events?

Comments in 'Plugin Development' started by TigerHix, May 12, 2015.

  1. TigerHix
    Offline

    TigerHix Active Member

    Joined:
    May 11, 2015
    Posts:
    61
    Minecraft User:
    TigerHix
    Came from Bukkit, and I was impressed by the PocketMine's simple and easy-to-use API. Though I cannot seem to find a function to unregister events in a Listener, neither unregistering a existent RegisteredListener. Is the feature planned or simply I missed something? :oops:

    Thanks in advance,
    - Tiger
    64FF00 and iksaku like this.
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Unregister all events of listeners attached to plugin
    PHP:
    HandlerList::unregisterAll($plugin);
    Unregister all events of a listener
    PHP:
    HandlerList::unregisterAll($listener);
    Unregister a certain event from all listeners attached to a plugin
    PHP:
    $event->getHandlers()->unregister($plugin);
    Unregister a certain event from a specific listener
    PHP:
    $event->getHandlers()->unregister($listener);
    Last edited: May 12, 2015
    Philipp, EvolSoft, xpyctum and 5 others like this.
  3. TigerHix
    Offline

    TigerHix Active Member

    Joined:
    May 11, 2015
    Posts:
    61
    Minecraft User:
    TigerHix
    Thanks for the reply! Should have searched that in docs. Surprisingly PocketMine API is almost same to Bukkit API.
  4. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    It was designed to be similar.
    TigerHix and Jon like this.
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Yes... [​IMG][​IMG]

Share This Page

Advertisement