Skip to content

Parameters

mario edited this page Mar 29, 2026 · 1 revision

Parameters

Parameters are declared with @Param on method arguments. The framework resolves, validates, and tab-completes them automatically.

@Param Reference

Property Type Default Description
name String Display name used in the auto-generated usage message.
required boolean true Whether the argument is mandatory. Optional arguments appear as [name] in the usage message.
concated boolean false Joins all remaining arguments into a single String. Shown as <name..> in the usage message.
defaultValue String "" Raw value passed through the processor when the argument is omitted. Requires required = false.

Built-in Types

Bukkit

Type Notes
int
long
double
float
boolean Accepts true/false
Player Online players only. Tab-completes automatically.
OfflinePlayer Resolves by name. No tab completion.
World Tab-completes loaded worlds.
GameMode Accepts survival, creative, adventure, spectator.
ChatColor
Duration Accepts formats like 10s, 5m, 1h.

BungeeCord & Velocity

Type Notes
int
long
double
float
boolean Accepts true/false

For other types, register a Custom Processor.

Examples

// Required parameter
@Command(names = {"kick"}, permission = "plugin.kick")
public void kickCommand(CommandSender sender, @Param(name = "player") Player target) {
    target.kickPlayer("Kicked.");
}

// Optional parameter with default value
@Command(names = {"heal"}, permission = "plugin.heal")
public void healCommand(CommandSender sender,
                        @Param(name = "target", required = false) Player target) {
    Player toHeal = target != null ? target : (Player) sender;
    toHeal.setHealth(toHeal.getMaxHealth());
}

// Concatenated — joins all remaining words into one string
@Command(names = {"broadcast"}, permission = "plugin.broadcast")
public void broadcastCommand(CommandSender sender,
                             @Param(name = "message", concated = true) String message) {
    Bukkit.broadcastMessage(message);
}

Clone this wiki locally