Skip to main content

@ExecutableBy

Restricts which type of sender can execute a command or subcommand.

Usage


@Sub(value = "reload", description = "Reload config")
@ExecutableBy(SenderType.CONSOLE)
public void reload(CommandContext ctx){
// only the console can run this
}

Sender Types

ValueDescription
SenderType.ALLAny sender can run this command. This is the default.
SenderType.PLAYEROnly players can run this command. Console senders are rejected.
SenderType.CONSOLEOnly the console can run this command. Players are rejected.

Class-Level Usage

Applying @ExecutableBy to the class sets a default for all subcommands:


@Command(value = "play", description = "Player commands")
@ExecutableBy(SenderType.PLAYER)
public class PlayCommand extends CommandBase {
// all subcommands require a player sender unless overridden
}

Resolution Order

Method-level @ExecutableBy takes precedence over class-level. If neither is present, SenderType.ALL is used.