Skip to content

CommandAPI for Bukkit

Jorel Ali edited this page Feb 23, 2023 · 3 revisions

The CommandAPI for Bukkit is a subproject that targets Bukkit, Spigot and Paper Minecraft platforms. This project is currently the largest and most complex project, but generally follows this structure:

commandapi-core
commandapi-platforms
└── commandapi-bukkit
    ├── commandapi-bukkit-core
    ├── commandapi-bukkit-kotlin
    ├── commandapi-bukkit-nms
    │   ├── commandapi-bukkit-x.x.x
    │   ├── commandapi-bukkit-nms-common
    │   └── commandapi-bukkit-nms-dependency
    ├── commandapi-bukkit-plugin
    ├── commandapi-bukkit-shade
    ├── commandapi-bukkit-test
    │   ├── commandapi-bukkit-kotlin-test
    │   ├── commandapi-bukkit-test-impl
    │   ├── commandapi-bukkit-test-impl-x.x.x
    │   ├── commandapi-bukkit-test-tests
    │   └── commandapi-bukkit-test-tests-x.x.x
    └── commandapi-bukkit-vh

Project structure

The project structure is as follows:

CommandAPI bukkit core represents the main implementation of the CommandAPI for Bukkit/Spigot/Paper. This primarily implements commandapi-core, an even more general implementation of the CommandAPI that can be adapted to any platform that uses Brigadier.

CommandAPI bukkit kotlin includes the Kotlin DSL for the CommandAPI. This is a separate module which is not packaged with the CommandAPI plugin or shaded version of the CommandAPI, but can be included standalone to allow developers to write CommandAPI commands using a Kotlin DSL syntax.

CommandAPI bukkit NMS contains all of the NMS (net.minecraft.server) specific code for each Minecraft version. Some of these projects use inheritance to reduce code duplication where necessary.

Commandapi bukkit plugin is the Bukkit/Spigot/Paper plugin that lets users use the CommandAPI standalone (without shading it). This is also the project that is published to Spigot and Modrinth.

This submodule contains code specific to the plugin command converter which can be used in the CommandAPI's config.yml file, as well as a standard plugin implementation of JavaPlugin.

This submodule is a packaged version of all of the relevant dependencies required to use the CommandAPI. This compiles together commandapi-core, commandapi-bukkit-core, commandapi-bukkit-nms and commandapi-bukkit-vh

This submodule contains unit and integration tests of the CommandAPI for Bukkit. This uses a combination of Mockito, to mock NMS classes (such as MinecraftServer) and MockBukkit to mock various Minecraft versions. This lets us test the CommandAPI across all supported versions of Minecraft!

Tests from commandapi-bukkit-test are also passed through to a code coverage tool to ensure the CommandAPI is well tested.

This submodule links all of the NMS implementations together with a switch, to let the CommandAPI figure out which NMS version to load at runtime. This is used in commandapi-bukkit-shade and commandapi-bukkit-plugin.