Java server development on Paper · 3 min read

Your first Paper 26.3 plugin: the project, JAR and loading checks

A minimal plugin must first load reliably. Let's create TrailNotes for Paper 26.3 and Java 25: it will write one line to the log, and the archive can be checked before starting the server.

LonelyCraft editors · Updated

Desktop with computer and world Minecraft on screen
Illustration: desktop with a computer and world Minecraft on the screen. This is an artistic scene, not a snapshot of a specific server.

Pin Java, Gradle and the API

In IntelliJ IDEA, create a Java project with a Gradle Kotlin DSL named TrailNotes. Select JDK 25. In the project terminal, execute java -version and ./gradlew --version: Java launch Gradle and compiler toolchain - different settings. To run Gradle in Java, 25 requires version 9.1.0 or later; reconciliation - in Gradle matrix.

In settings.gradle.kts save rootProject.name = "TrailNotes"; The contents of build.gradle.kts are shown below. Paper API build 238 for 26.3 is pinned here. This is an educational fixed build, not a promise of the latest version. The new coordinate scheme is confirmed by Paper Project setup.

plugins { java }
group = "ru.example"
version = "1.0.0"
repositories {
    mavenCentral()
    maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
    compileOnly("io.papermc.paper:paper-api:26.3.build.238-stable")
}
java { toolchain.languageVersion.set(JavaLanguageVersion.of(25)) }
tasks.withType<JavaCompile>().configureEach { options.encoding = "UTF-8" }
Gradle project structure and two required JAR files
On the left are the edited files, on the right is the result of the assembly; manifest is located exactly at the root of the archive.Scroll the diagram horizontally.Open full-size diagram

Create a Java Class and Resource

The file src/main/java/ru/example/trailnotes/TrailNotesPlugin.java contains the code below. The package path and main in manifest must match character by character, including case.

package ru.example.trailnotes;

import org.bukkit.plugin.java.JavaPlugin;

public final class TrailNotesPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        getLogger().info("TrailNotes загружен");
    }
}

Put the manifest at the archive root

Create src/main/resources/plugin.yml with this content. api-version specifies the minimum server API, not the Java version. On Paper older than 26.3, this example intentionally does not load. The remaining fields are described in the manifest directory.

name: TrailNotes
version: 1.0.0
main: ru.example.trailnotes.TrailNotesPlugin
api-version: "26.3"

Check the build before installing it

From root, execute ./gradlew clean build and jar tf build/libs/TrailNotes-1.0.0.jar. On Windows, use ./gradlew.bat clean build. The archive needs plugin.yml and ru/example/trailnotes/TrailNotesPlugin.class; The server will not load the ZIP containing the project folder.

On the stopped test Paper, replace the old TrailNotes JAR with a single new file. Start the server with Java 25, find TrailNotes загружен in logs/latest.log, terminate via stop and restart. You need one line to enable the plugin.

MessageWhat to check
UnsupportedClassVersionErrorJava real server process, not just terminal IDE
Cannot find main classpackage, class name, main and path inside the JAR
Invalid plugin.ymlResource location, YAML and file extension
Could not resolve paper-apiAccess to official Maven and exact dependency coordinates

After successful loading, you can check the arguments and permissions of the command. Add first command.

A separate test directory allows you to test a new build without losing a working plugin. Install and rollback JAR.

Frequently asked questions

Is it possible to put paper-api inside a JAR?

In this project it compileOnly: the API classes are provided by Paper. Including a second copy creates a type conflict and increases the size of the archive.

Why does the IDE build, but Gradle crashes in the terminal?

Compare Gradle JVM in IDE settings with JVM in ./gradlew --version. Toolchain 25 by itself does not update the old Gradle.

Is it possible to change the JAR while the server is running?

The new version of the class will not replace the one already loaded. For this cycle, end the test process with stop, then replace the archive.

Views: … · One view per browser per day

Was this useful?Total score: …

One reaction per browser. Click again to remove it, or choose the other reaction.

Sources and documentation

Minecraftplugin developmentPaper

Read on

First Paper plugin 26.3: project, JAR and loading check - LonelyCraft — Lonely Craft