CommandIssuer

This is a guide to learn how to use CommandIssuer class.

What is CommandIssuer ?

CommandIssuer is like the CommandSender class but with more features. An instance of this class is automatically created when a user executes a command and it is accessible in the onCommand() method.

Available methods

Method

Type

Description

isPlayer()

void

Returns true if CommandSender is a player or false if it isn't

getPlayer()

Player

Returns the CommandSender converted as Player

getIssuerType()

IssuerType

Returns the type of user who has executed the command (PLAYER or CONSOLE)

getCommandSender()

CommandSender

Returns the CommandSender

getCommand()

SmartCommand

Returns the issued command as SmartCommand

getBukkitCommand()

Command

Returns the issued command as Command

sendCommandMessage(String path)

void

Send the message at the specified path

sendTextComponent(String path)

void

Send the TextComponent at the specified path

sendMessage(String message)

void

Send a message to the CommandSender

sendCommandMessage() and sendTextComponent() methods are available only if you're using a command resource file containing a CommandMessagesection.

If you're using CommandHelp or CommandUsage features, you can also use this method which will send help to the command issuer:

sendHelp(String label, String[] args, int page, boolean withPagination)

Parameter

Description

label

The label of the executed command

args

The arguments of the executed command

page

The number of the help page to send

withPagination

Set true to force the use of the page system or else set false

label and args are recovered from the onCommand() method.

Last updated