Package me.efekos.simpler.commands
Class CommandExecuteContext
java.lang.Object
me.efekos.simpler.commands.CommandExecuteContext
A context class that contains some information about a command execution.
-
Constructor Summary
ConstructorsConstructorDescriptionCommandExecuteContext(org.bukkit.command.CommandSender sender, List<String> args) Creates a new context to use for runningCommandExecutives ofCommandNodes. -
Method Summary
Modifier and TypeMethodDescriptiongetArgs()Returns a list of the arguments that sender gave.org.bukkit.command.CommandSenderReturns the sender that ran this command.org.bukkit.command.ConsoleCommandSenderCasts the sender to aConsoleCommandSender, then returns it.org.bukkit.entity.PlayerCasts the sender to aPlayer, then returns it.booleanChecks what sender is, and returns whether the sender is the console or not.booleanChecks what sender is, and returns whether the sender is a player or not.
-
Constructor Details
-
CommandExecuteContext
Creates a new context to use for runningCommandExecutives ofCommandNodes.- Parameters:
sender- Sender that ran this command.args- List of the arguments sender gave.
-
-
Method Details
-
isSenderPlayer
public boolean isSenderPlayer()Checks what sender is, and returns whether the sender is a player or not.- Returns:
trueif sender is a player.
-
isSenderConsole
public boolean isSenderConsole()Checks what sender is, and returns whether the sender is the console or not.- Returns:
trueif sender is the console.
-
getSender
public org.bukkit.command.CommandSender getSender()Returns the sender that ran this command.- Returns:
- Sender of this context.
-
getSenderAsPlayer
public org.bukkit.entity.Player getSenderAsPlayer()Casts the sender to aPlayer, then returns it. Make sure to use this only whenisSenderPlayer()istrue.- Returns:
- Sender of this context as
Player.
-
getSenderAsConsole
public org.bukkit.command.ConsoleCommandSender getSenderAsConsole()Casts the sender to aConsoleCommandSender, then returns it. Make sure to use this only whenisSenderConsole()istrue.- Returns:
- Sender of this context as
ConsoleCommandSender.
-
getArgs
Returns a list of the arguments that sender gave. Keep in mind thatLabelNodes are filtered out from this list. You'll only get the arguments.- Returns:
- Argument list of this context.
-