Interface CommandSourceStack
The command source type for Brigadier commands registered using Paper API.
While the general use case for CommandSourceStack is similar to that of CommandSender, it provides access to
important additional context for the command execution.
Specifically, commands such as /execute may alter the location or executor of the source stack before
passing it to another command.
The CommandSender returned by getSender() may be a "no-op"
instance of CommandSender in cases where the server either doesn't
exist yet, or no specific sender is available. Methods on such a CommandSender
will either have no effect or throw an UnsupportedOperationException.
-
Method Summary
Modifier and TypeMethodDescriptionGets the entity that executes this command.Gets the location that this command is being executed at.Gets the command sender that executed this command.
-
Method Details
-
getLocation
Location getLocation()Gets the location that this command is being executed at.- Returns:
- a cloned location instance.
-
getSender
CommandSender getSender()Gets the command sender that executed this command. The sender of a command source stack is the one that initiated/triggered the execution of a command. It differs togetExecutor()as the executor can be changed by a command, e.g. /execute.- Returns:
- the command sender instance
-
getExecutor
Gets the entity that executes this command. May not always begetSender()as the executor of a command can be changed to a different entity than the one that triggered the command.- Returns:
- entity that executes this command
-