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
enum.
If you want to change the outcome of an event, choose very carefully from LOWEST to HIGHEST. Suggested generalized protection plugins on LOWEST, more specific plugins on NORMAL, and override plugins on HIGH. If you want to act when an event happens, but not change the outcome, use MONITOR.
Note: The MONITOR priority should only be used for reading only. This priority is useful for logging plugins to see the results of an event and modifying values may interfere with those types of plugins.
ignoreCancelled - A boolean which indicates whether or not your listener should fire if the event has been cancelled before it is the listener's turn to handle the event. False by default.
import org.bukkit.event.Listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerLoginEvent;
public final class LoginListener implements Listener {
@EventHandler
public void normalLogin(PlayerLoginEvent event) {
// Some code here
}
@EventHandler(priority = EventPriority.HIGH)
public void highLogin(PlayerLoginEvent event) {
// Some code here
}
}