Solved Disable and enable a @EventHandler

Discussion in 'Plugin Development' started by Pattrick, Mar 11, 2016.

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


    Is there a way to enable and disable a @EventHandler?

    Hi all,
    I would like to know if it is possible to enable/disable a @EventHandler with a command?
  2. Offline


    What do you mean? Disable a listener?

    Make an boolean and then set the boolean to true when a player does /<command> on and set it to false when a player does /<command> off. Then in the listener, check if the boolean is true or false. If false, just stop the code.
  3. Offline


    If the event is handled in it's own class, you can use Bukkit.unregisterEvents(event class); to unregistered a class.
  4. Offline


    Do you mean cancell an event? You can do it with a method called setCancelled();
  5. Offline


    Thank you!
  6. Offline


Thread Status:
Not open for further replies.

Share This Page