Skip to content

Error Messages

mario edited this page Mar 29, 2026 · 1 revision

Error Messages

By default the framework sends built-in English messages for common error conditions. All of them can be overridden before registering commands.

Bukkit

public void onEnable() {
    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.");

    BukkitCommandHandler.registerCommands("me.myplugin.commands", this);
}

BungeeCord

public void onEnable() {
    BungeeCommandHandler.setNoPermissionMessage("You don't have permission.");
    BungeeCommandHandler.setPlayerOnlyMessage("Only players can use this.");
    BungeeCommandHandler.setConsoleOnlyMessage("Only console can use this.");
    BungeeCommandHandler.setInternalErrorMessage("Internal error occurred.");

    BungeeCommandHandler.registerCommands("me.myplugin.commands", this);
}

Velocity

Velocity uses the Adventure API — messages are Component instead of plain strings.

public void onProxyInitialize(ProxyInitializeEvent event) {
    VelocityCommandHandler.setNoPermissionMessage(
        Component.text("You don't have permission.", NamedTextColor.RED));
    VelocityCommandHandler.setPlayerOnlyMessage(
        Component.text("Only players can use this.", NamedTextColor.RED));
    VelocityCommandHandler.setConsoleOnlyMessage(
        Component.text("Only console can use this.", NamedTextColor.RED));
    VelocityCommandHandler.setInternalErrorMessage(
        Component.text("Internal error occurred.", NamedTextColor.RED));

    VelocityCommandHandler.registerCommands("me.myplugin.commands", this, server);
}

Default Values

Message Default
noPermissionMessage I'm sorry, but you do not have permission to perform this command.
playerOnlyMessage You must be a player to execute this command.
consoleOnlyMessage This command can only be executed by console.
internalErrorMessage An internal error occurred while executing this command.

Clone this wiki locally