Skip to main content
Events are the primary way plugins interact with server and player actions. Paper’s event system allows you to listen for and respond to hundreds of different events.

Event Basics

All events extend the org.bukkit.event.Event class and are called by the PluginManager.

The Event Class

From org.bukkit.event.Event:

Creating an Event Listener

1

Create a Listener Class

Create a class that implements the Listener interface:
The Listener interface is a marker interface with no methods (from org.bukkit.event.Listener):
2

Register the Listener

Register your listener in the plugin’s onEnable() method:
The second parameter is your plugin instance, which is used to track which plugin registered the listener.

The @EventHandler Annotation

The @EventHandler annotation marks methods as event handlers. From org.bukkit.event.EventHandler:

Event Priority

Control the order in which your event handler is called:
Priority order (from org.bukkit.event.EventPriority):
  1. LOWEST - Called first, for early modifications
  2. LOW - Called early
  3. NORMAL - Default priority
  4. HIGH - Called late
  5. HIGHEST - Called very late, final modifications
  6. MONITOR - Read-only, for observation (don’t modify events!)
The MONITOR priority should only be used for observing events, not modifying them. Changes made at this priority may not be respected by other plugins.

Ignore Cancelled Events

Skip cancelled events with the ignoreCancelled parameter:

Common Events

Player Events

Listen for player-related events:

PlayerJoinEvent Example

From org.bukkit.event.player.PlayerJoinEvent:

Block Events

Entity Events

Cancellable Events

Many events can be cancelled to prevent the action from occurring:

Calling Events

You can create and call custom events:
Or use the convenience method from the Event class:

Asynchronous Events

Some events are fired asynchronously (off the main thread):
Asynchronous event handlers must be thread-safe. Most Bukkit API methods should not be called from async events. Use Bukkit.getScheduler().runTask() to schedule tasks on the main thread if needed.

Best Practices

  1. Use the correct priority:
    • LOWEST/LOW for early cancellation
    • NORMAL for most modifications
    • HIGH/HIGHEST for final modifications
    • MONITOR only for observation
  2. Check event state:
  3. Performance considerations:
  4. Unregister when done:
  5. Use ignoreCancelled wisely:
    • Set to true when you don’t want to process cancelled events
    • Set to false when you need to see all events regardless of cancellation

Event Reference

Common event packages:
  • org.bukkit.event.player.* - Player events
  • org.bukkit.event.block.* - Block events
  • org.bukkit.event.entity.* - Entity events
  • org.bukkit.event.inventory.* - Inventory events
  • org.bukkit.event.world.* - World events
  • org.bukkit.event.server.* - Server events
For a complete list, see the Paper API Javadocs.