Create a PaperMC Event Listener with Reedwork in 5 Minutes
By the end of this tutorial, you will have a working PaperMC event listener that automatically gets discovered and registered by Reedwork.
1. Install Reedwork
Section titled “1. Install Reedwork”First, add Reedwork to your Paper plugin project.
2. Scan Your Plugin Package
Section titled “2. Scan Your Plugin Package”Reedwork uses package scanning to discover annotated components such as event listeners.
Start by creating your main plugin class:
package dev.reedworkmc.examples.fiveminuteeventlistener;
import dev.reedworkmc.reedwork.Reedwork;import org.bukkit.plugin.java.JavaPlugin;
public final class FiveMinuteEventListener extends JavaPlugin {
@Override public void onEnable() { // Plugin startup logic Reedwork.create(this).scan("dev.reedworkmc.examples.fiveminuteeventlistener"); }}This creates a Reedwork instance for your plugin and scans the specified package for Reedwork components.
Because the event listener is located inside this package, Reedwork automatically discovers it.
For example:
Directorysrc/main/java/
Directorydev.reedworkmc.examples.fiveminuteeventlistener
- FiveMinuteEventListener.java
You do not need to manually register the listener with Bukkit.
3. Create the Event Listener
Section titled “3. Create the Event Listener”Create an events package.
Create PlayerJoinServerEventListener:
Directorysrc/main/java/
Directorydev.reedworkmc.examples.fiveminuteeventlistener
Directoryevents
- PlayerJoinServerEventListener.java
- FiveMinuteEventListener.java
package dev.reedworkmc.examples.fiveminuteeventlistener.events;
import dev.reedworkmc.reedwork.annotation.EventListener;import net.kyori.adventure.text.Component;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;import org.bukkit.event.player.PlayerJoinEvent;
@EventListenerpublic class PlayerJoinServerEventListener implements Listener {
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); player.sendMessage(Component.text("Hello Reedwork!")); }}There are two important annotations here.
@EventListener
Section titled “@EventListener”@EventListenerThis tells Reedwork that the class should be automatically discovered and registered as a Bukkit event listener.
The class still uses the normal Bukkit Listener interface.
@EventHandler
@EventHandlerpublic void onPlayerJoin(PlayerJoinEvent event) { // Handling here}This is the standard Bukkit event handler annotation.
Reedwork does not replace Bukkit’s event system. It only handles discovery and registration.
When a player joins, the event method is executed:
Player player = event.getPlayer();player.sendMessage(Component.text("Hello Reedwork!"));4. Build and Test
Section titled “4. Build and Test”Build your plugin:
mvn clean packageCopy the resulting JAR from target/ into the plugins/ directory of your Paper server.
Start the server.
Reedwork will scan:
dev.reedworkmc.examples.fiveminuteeventlistenerand automatically discover PlayerJoinServerEventListener.
Join the server.
The joining player receives:
Hello Reedwork!That’s it — you have created a PaperMC event listener with Reedwork without manually registering it.
What You Learned
Section titled “What You Learned”In just a few minutes, you learned how to:
Add Reedwork to a PaperMC plugin Initialize Reedwork with Reedwork.create(this) Scan your plugin package
Let Reedwork automatically discover and register listeners
- Install Reedwork in a PaperMC plugin
- Initialize Reedwork with
Reedwork.create(this) - Scan your plugin package
- Create an event listener with
@EventListener - Use Bukkit’s standard
@EventHandler - Let Reedwork automatically discover and register the command
Next Steps
Section titled “Next Steps”Now that you have created your first event listener, explore what else Reedwork can do.
Check out the event documentation for more advanced features, or continue with:
- Commands — create powerful PaperMC commands
- Dependency Injection — inject dependencies into your components
- Custom Enchantments — create your first Reedwork enchantment