Tutorial by Examples

import org.bukkit.event.Listener; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; public class MyEventListener implements Listener { /** * Constructor ...
public class Main extends JavaPlugin { @Override public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); } @EventHandler public void yourEvent(Event e) { //... } }
Bukkit uses an event based system that allows plugin developers to interact with and modify the server and specific actions that occur in the world. Creating an Event Handler Event handlers are methods that get called when their event occurs. They are generally public and void as well as named o...
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...
Bukkit uses an event based system that allows plugin developers to interact with and modify the server and specific actions that occur in the world. Creating an Event Handler Event handlers are methods that get called when their event occurs. They are generally public and void as well as named o...
Bukkit has a system called Event Priorities to help plugins handle events in the correct older. The seven priorities are (in older from first executed to last): Lowest Low Normal (default) High Highest Monitor If you are planning to cancel a lot of events (e.g. protection plugin) it would...

Page 1 of 1