Skip to Content
MineDuels

Build from source

Project layout, building the plugin and API jars, running the tests, and the proxy plugin.

What you need

  • JDK 21. The Gradle toolchain is set to 21, and Gradle can download one if it is missing.
  • Nothing else. The Gradle wrapper (./gradlew) downloads Gradle itself (9.7.1).

Layout

The Paper plugin is a Gradle project with three modules:

ModuleContains
apiThe public API: the MineDuelsApi service, the snapshot records and the events. Built as its own jar for other plugins
commonThe cross-server protocol: signed Redis messages, rate limits, the server directory. Shared with the Velocity plugin
coreThe plugin: matches, queues, parties, storage, GUIs, the web API

The core jar also contains the classes of api and common, so one jar is all a server needs.

The Velocity plugin is a separate project with common and proxy-velocity. Its common module is a copy of the plugin's, and the two must stay identical. After changing it, copy it to the other project and check:

diff -r MineDuels-Plugin-source/common/src/main MineDuels-Velocity-source/common/src/main

No output means they match.

Build

From the plugin project folder:

./gradlew build

This compiles every module, runs the tests and builds the jars. The jars are here:

core/build/libs/MineDuels-0.10.0.jar          the plugin
api/build/libs/MineDuels-API-0.10.0.jar       the API for other plugins
api/build/libs/MineDuels-API-0.10.0-sources.jar

Only the plugin jar:

./gradlew :core:jar

The version comes from version in the root build.gradle.kts.

On Windows use gradlew.bat. If the wrapper is not executable on Linux, run sh ./gradlew build.

The Velocity plugin

cd MineDuels-Velocity-source
./gradlew build

The proxy jar is under proxy-velocity/build/libs/. Use a proxy jar and backend jars from the same version. They refuse each other's messages when the protocol versions differ.

Run the tests

./gradlew test                               # everything
./gradlew :core:test                         # the plugin
./gradlew :common:test                       # the protocol
./gradlew :core:test --tests 'dev.mineduels.web.*'   # one package

Reports are in core/build/reports/tests/test/index.html.

The tests cover the protocol (signing, replay and rate limits, sender rules), the queue and match logic, storage, config upgrades and the web API. The web API tests start the HTTP server on a free port and call it for real, including rate limits, overload and config edits.

Add a test for new code in the same package as the code under test. The project uses JUnit 5.

Dependencies

The plugin does not bundle its libraries. Paper downloads them from plugin.yml libraries: on first start:

libraries:
  - com.zaxxer:HikariCP:6.2.1
  - org.xerial:sqlite-jdbc:3.47.1.0
  - org.mariadb.jdbc:mariadb-java-client:3.5.1
  - redis.clients:jedis:5.2.0

When you change a version in core/build.gradle.kts, change it in plugin.yml as well. A comment in the build file reminds you. Jedis is only used when cross-server is enabled.

Optional integrations (PlaceholderAPI, PacketEvents, ViaVersion) are compile-only and listed as soft dependencies.

Compile against a different Paper version

The Paper API version is set in core/build.gradle.kts and api/build.gradle.kts:

val paperApi = "io.papermc.paper:paper-api:1.21.6-R0.1-SNAPSHOT"

Keep api-version: '1.21' in plugin.yml.

Try a build

  1. Copy MineDuels-0.10.0.jar into a test server's plugins/ folder.
  2. Start the server and check the console for Enabled MineDuels.
  3. Run the bot suite against it. See Testing with bots.

Common problems

ProblemCause and fix
Unsupported class file major versionThe build ran on a JDK older than 21. Set JAVA_HOME to JDK 21
Could not resolve io.papermc.paper:paper-apiThe Paper repository is unreachable. Check the network, or use --offline when everything is cached
A test fails only in one packageRun it alone with --tests and read its report
The proxy ignores the backendsThe jars are from different versions, or common differs between the projects

On this page