Skip to content

Bukkit Implementation

mario edited this page Mar 29, 2026 · 4 revisions

Bukkit

Compatible with Bukkit, Spigot, Paper, and any fork — including Folia.

Registering Commands

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 Types

Sender Usage
CommandSender Accepts both players and console
Player Implies playerOnly = true automatically
ConsoleCommandSender Implies consoleOnly = true automatically

Async

Setting async = true runs the method off the main thread. On Folia, it is automatically routed through AsyncScheduler — no extra configuration needed.

Error Messages

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.");

Further Reading

Clone this wiki locally