用于在 Bukkit 插件中使用 Minecraft 1.13 的"brigadier"库的工具。
commodore is a utility for using Minecraft's 1.13 brigadier library in Bukkit plugins. It allows you to easily register command completion data for your plugin's commands.
If you have questions, feel free to ask in Discord.
commodore supports:
LiteralCommandNode builder API.commodore file formatFor example, implementing completions for Minecraft's /time command:
LiteralCommandNode builder API….commodore file formattime {
set {
day;
noon;
night;
midnight;
time brigadier:integer;
}
add {
time brigadier:integer;
}
query {
daytime;
gametime;
day;
}
}// assuming the file above is stored as "time.commodore" in the plugin jar
LiteralCommandNode timeCommand = CommodoreFileFormat.parse(plugin.getResource("time.commodore"));
commodore.register(bukkitCommand, timeCommand);Using the .commodore file format is recommended. In my opinion it is much easier to read/understand/update than the Node Builder API provided by brigadier.
Another example of a .commodore file can be found here, for the LuckPerms plugin commands. The corresponding code used to register the completions is here.
This guide assumes your plugin is built using Maven or Gradle though.
Maven
You need to add (or merge) the following sections into your pom.xml file.
…Gradle
You need to add (or merge) the following sections into your build.gradle file.
plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
repositories {
mavenCentral()
maven { url 'https://libraries.minecraft.net/' }
}
dependencies {
/* vvv Replace with the latest commodore version vvv */
implementation 'me.lucko:commodore:{version}'
}
shadowJar {
dependencies {
exclude(dependency('com.mojang:brigadier'))
}
/* vvv Replace with the package of your plugin vvv */
relocate 'me.lucko.commodore', 'com.yourdomain.yourplugin.commodore'
}Replace {version} with the latest version:
…The com.mojang.brigadier packages will be automatically imported into your classpath when you add the commodore dependency, but they should not be shaded into your plugins jar file.
暂无开放 Issues,或尚未同步最近议题。