Prerequisites
- Java Development Kit (JDK) 21 or higher
- A Java IDE (IntelliJ IDEA recommended)
- Basic knowledge of Java programming
Project Setup
Add Paper API Dependency
Configure your build tool to include the Paper API dependency.
The
provided scope (Maven) or compileOnly (Gradle) is used because the Paper server already includes the API at runtime.Create Main Plugin Class
Create a class that extends
JavaPlugin. This is the entry point for your plugin.Create paper-plugin.yml
Create a See the paper-plugin.yml reference for all available options.
paper-plugin.yml file in your src/main/resources directory to describe your plugin.Key Classes and Interfaces
JavaPlugin
TheJavaPlugin class (package: org.bukkit.plugin.java.JavaPlugin) is the base class for all plugins. It provides:
- Lifecycle methods:
onLoad(),onEnable(),onDisable() - Server access:
getServer()returns the Server instance - Data folder:
getDataFolder()returns your plugin’s data directory - Logger:
getLogger()returns a logger for your plugin - Configuration:
getConfig(),saveConfig(),reloadConfig() - Metadata:
getPluginMeta()returns plugin information
PluginMeta
ThePluginMeta interface (package: io.papermc.paper.plugin.configuration.PluginMeta) provides access to plugin metadata:
Static Plugin Access
You can get a reference to your plugin instance from anywhere in your code:Next Steps
- Learn about the plugin lifecycle
- Create event listeners
- Register commands
- Set up configuration files