-
Notifications
You must be signed in to change notification settings - Fork 0
Bukkit Implementation
mario edited this page Mar 29, 2026
·
4 revisions
Compatible with Bukkit, Spigot, Paper, and any fork — including Folia.
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Recommended — scans the entire package
BukkitCommandHandler.registerCommands("me.myplugin.commands", this);
// Register a single class
BukkitCommandHandler.registerCommands(MyCommands.class, this);
// Register multiple classes at once
BukkitCommandHandler.registerCommands(this, MyCommands.class, AdminCommands.class);
}
}| Sender | Usage |
|---|---|
CommandSender |
Accepts both players and console |
Player |
Implies playerOnly = true automatically |
ConsoleCommandSender |
Implies consoleOnly = true automatically |
Setting async = true runs the method off the main thread. On Folia, it is automatically
routed through AsyncScheduler — no extra configuration needed.
By default the framework sends built-in English messages. You can override any of them
in onEnable() before registering commands.
BukkitCommandHandler.setNoPermissionMessage(ChatColor.RED + "You don't have permission.");
BukkitCommandHandler.setPlayerOnlyMessage(ChatColor.RED + "Only players can use this.");
BukkitCommandHandler.setConsoleOnlyMessage(ChatColor.RED + "Only console can use this.");
BukkitCommandHandler.setInternalErrorMessage(ChatColor.RED + "Internal error occurred.");