Tutorial by Examples

To register your methods, the class containing the EventHandler(s) must implement the Listener interface. import org.bukkit.event.Listener; public final class ListenerClass implements Listener { } You need to register the event listener by adding the following call to your onEnable method in...
The org.bukkit.event.EventHandler annotation accepts a couple parameters. priority - Indicates the priority of your listener. There are the six different priorities, in order of execution: LOWEST,LOW,NORMAL[default],HIGH,HIGHEST,MONITOR. These constants refer to the org.bukkit.event.EventPriority e...
Sometimes you need to create your own Event, one that other plugins can listen to (Vault, among other plugins, does this) and even cancel. Bukkit's Event API allows this to be possible. All you need to do is make a new class, have it extend Event, add the handlers and the attributes your event needs...
You can un-register individual events, entire listener classes or all events registered by your plugin or even by other plugins! Un-register specific event Each event class has the getHandlerList() static method, call that and then you can use .unregister() method. PlayerInteractEvent.getHandlerL...

Page 1 of 1