Third-Party Plugin Integration
BetterPlugin can be used by other plugins as a runtime dependency. Commands registered with create(plugin) belong to the calling plugin, not BetterPlugin.
1. Add the Dependency
Third-party plugins use JitPack to consume published tags directly; no local build or publishing is needed. The first time a version is requested, JitPack builds it in the cloud, which can take a moment.
Add the following to the consuming project's build.gradle.kts:
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.CoffeePopStudio:BetterPlugin:26.13.0-mc26.1.2")
}See JitPack for build status and the list of versions.
2. Add the Runtime Dependency
Consumer plugins must declare the BetterPlugin dependency in plugin.yml:
name: MyPlugin
version: 1.0.0
main: com.example.MyPlugin
api-version: '26.1.2'
depend: [BetterPlugin]Also place the BetterPlugin jar in the server's plugins/ directory, for example by downloading it from JitPack:
https://jitpack.io/com/github/CoffeePopStudio/BetterPlugin/26.13.0-mc26.1.2/BetterPlugin-26.13.0-mc26.1.2.jarThe
dependentry inplugin.ymlonly controls runtime load order; you still need the compile-time dependency from step 1.
3. Register Commands
import org.bukkit.plugin.java.JavaPlugin;
import org.coffeepop.betterPlugin.api.command.CommandBuilder;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
CommandBuilder.create(this)
.name("hello")
.executes((sender, command, label, args) -> {
sender.sendPlainMessage("Hello from MyPlugin");
return true;
})
.register();
}
}The main class can also extend PluginBase; both approaches work. See Plugin Basics.
4. Specify the Plugin
The two forms are equivalent:
CommandBuilder.create(this)
.name("hello")
.executes((sender, command, label, args) -> true)
.register();Or:
CommandBuilder.create()
.plugin(this)
.name("hello")
.executes((sender, command, label, args) -> true)
.register();Note: if you don't set
.plugin(), the command is registered under BetterPlugin. Third-party plugins must usecreate(this)or.plugin(this).
5. Permission, Aliases, Completion
import java.util.List;
import org.coffeepop.betterPlugin.api.command.CommandBuilder;
CommandBuilder.create(this)
.name("give")
.permission("myplugin.give")
.aliases("i")
.executes((sender, command, label, args) -> {
// ...
return true;
})
.tabCompleter((sender, command, label, args) -> {
if (args.length == 1) {
return List.of("diamond", "iron", "gold");
}
return List.of();
})
.register();For more capabilities and limitations, see Command API Reference.