CommandAPI 9.3.0
An API for the command UI introduced in Minecraft 1.13
Package dev.jorel.commandapi.executors

Classes relating to the different FunctionalInterfaces for command execution. More...

Classes

interface  CommandBlockCommandExecutor
 A normal command executor for a BlockCommandSender. More...
 
interface  CommandBlockExecutionInfo
 
interface  CommandBlockResultingCommandExecutor
 A resulting command executor for a BlockCommandSender. More...
 
interface  CommandBlockResultingExecutionInfo
 
interface  CommandExecutionInfo
 
interface  CommandExecutor
 A normal command executor for a CommandSender. More...
 
interface  ConsoleCommandExecutor
 A normal command executor for a ConsoleCommandSender. More...
 
interface  ConsoleExecutionInfo
 
interface  ConsoleResultingCommandExecutor
 A resulting command executor for a ConsoleCommandSender. More...
 
interface  ConsoleResultingExecutionInfo
 
interface  EntityCommandExecutor
 A normal command executor for an Entity. More...
 
interface  EntityExecutionInfo
 
interface  EntityResultingCommandExecutor
 A resulting command executor for an Entity. More...
 
interface  EntityResultingExecutionInfo
 
interface  ExecutionInfo
 This interface represents an ExecutionInfo for a command. More...
 
enum  ExecutorType
 An enum representing the type of an executor. More...
 
interface  FeedbackForwardingCommandExecutor
 A normal command executor for a BlockCommandSender. More...
 
interface  FeedbackForwardingExecutionInfo
 
interface  FeedbackForwardingResultingCommandExecutor
 A resulting command executor for a BlockCommandSender. More...
 
interface  FeedbackForwardingResultingExecutionInfo
 
interface  NativeCommandExecutor
 A normal command executor for a NativeProxyCommandSender. More...
 
interface  NativeExecutionInfo
 
interface  NativeResultingCommandExecutor
 A resulting command executor for a NativeProxyCommandSender. More...
 
interface  NativeResultingExecutionInfo
 
interface  NormalExecutor
 The interface for normal command executors. More...
 
interface  PlayerCommandExecutor
 A normal command executor for a Player. More...
 
interface  PlayerExecutionInfo
 
interface  PlayerResultingCommandExecutor
 A resulting command executor for a Player. More...
 
interface  PlayerResultingExecutionInfo
 
interface  ProxyCommandExecutor
 A normal command executor for a NativeProxyCommandSender. More...
 
interface  ProxyExecutionInfo
 
interface  ProxyResultingCommandExecutor
 A resulting command executor for a NativeProxyCommandSender. More...
 
interface  ProxyResultingExecutionInfo
 
interface  RemoteConsoleCommandExecutor
 
interface  RemoteConsoleExecutionInfo
 
interface  RemoteConsoleResultingCommandExecutor
 
interface  RemoteConsoleResultingExecutionInfo
 
interface  ResultingCommandExecutionInfo
 
interface  ResultingCommandExecutor
 A resulting command executor for a CommandSender. More...
 
interface  ResultingExecutor
 The interface for resulting command executors. More...
 
interface  TypedExecutor
 An interface that includes the type of an executor (what command senders it can execute) and has a method that executes an executor with a given command sender and arguments. More...
 

Functions

record CommandArguments (Object[] args, Map< String, Object > argsMap, String[] rawArgs, Map< String, String > rawArgsMap, String fullInput)
 This class stores the arguments for this command. More...
 
record BukkitExecutionInfo< Sender > (Sender sender, BukkitCommandSender<? extends Sender > senderWrapper, CommandArguments args) implements ExecutionInfo< Sender
 This record represents a BukkitExecutionInfo for a command. More...
 

Detailed Description

Classes relating to the different FunctionalInterfaces for command execution.

Function Documentation

◆ BukkitExecutionInfo< Sender >()

record dev.jorel.commandapi.executors.BukkitExecutionInfo< Sender > ( Sender  sender,
BukkitCommandSender<? extends Sender >  senderWrapper,
CommandArguments  args 
)

This record represents a BukkitExecutionInfo for a command.

It provides the sender of a command, as well as it's arguments

Parameters
<Sender>The type of the sender of a command this BukkitExecutionInfo belongs to
Parameters
sender
Returns
The sender of this command
Parameters
senderWrapperThis is not intended for public use and is only used internally. The BukkitExecutionInfo#sender() method should be used instead!
Returns
The wrapper type of this command
Parameters
args
Returns
The arguments of this command

◆ CommandArguments()

record dev.jorel.commandapi.executors.CommandArguments ( Object[]  args,
Map< String, Object >  argsMap,
String[]  rawArgs,
Map< String, String >  rawArgsMap,
String  fullInput 
)

This class stores the arguments for this command.

Parameters
argsThe arguments for this command
argsMapThe arguments for this command mapped to their node names. This is an ordered map
rawArgsThe raw arguments for this command.
rawArgsMapThe raw arguments for this command mapped to their node names. This is an ordered map
fullInputThe command string a player has entered (including the /)
Returns
An unmodifiable clone of the mapping of node names to argument values
An unmodifiable clone of the mapping of node names to raw arguments

This returns the raw command string a player has entered

Deprecated:
This method has been deprecated in favour of CommandArguments#fullInput()
Returns
The raw command string a player has entered
The number of arguments for this command

Returns an argument by its position

Parameters
indexThe position of this argument
Returns
An argument which is placed at the given index, or null if the provided index does not point to an argument.

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
Returns
An argument which has the given node name. Can be null if nodeName was not found.

Returns an argument by its index

Parameters
indexThe position of this argument
defaultValueThe Object returned if the argument is not existent
Returns
An argument which is placed at the given index, or the provided default value

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
defaultValueThe Object returned if the argument was not found.
Returns
The argument with the specified node name or the provided default value

Returns an argument by its index

Parameters
indexThe position of this argument
defaultValueThe Object returned if the argument is not existent
Returns
An argument which is placed at the given index, or the provided default value

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
defaultValueThe Object returned if the argument was not found.
Returns
The argument with the specified node name or the provided default value

Returns an Optional holding the argument by its index

Parameters
indexThe position of this argument
Returns
An optional holding the argument which is placed at the given index, or an empty optional if index is invalid

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
Returns
An optional holding the argument with the specified node name or an empty optional if the node name was not found

Returns a raw argument by its position

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
indexThe position of this argument
Returns
An argument which is placed at the given index, or null if the provided index does not point to an argument.

Returns a raw argument by its node name

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
Returns
A raw argument which has the given node name. Can be null if nodeName was not found.

Returns a raw argument by its index

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
indexThe position of this argument
defaultValueThe String returned if the raw argument is not existent
Returns
A raw argument which is placed at the given index, or the provided default value

Returns a raw argument by its node name

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
defaultValueThe String returned if the raw argument was not found.
Returns
A raw argument with the specified node name or the provided default value

Returns a raw argument by its index

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
indexThe position of this argument
defaultValueThe String returned if the raw argument is not existent
Returns
A raw argument which is placed at the given index, or the provided default value

Returns a raw argument by its node name

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
nodeNameThe node name of this raw argument. This was set when initializing an argument
defaultValueThe String returned if the raw argument was not found.
Returns
A raw argument with the specified node name or the provided default value

Returns an Optional holding the raw argument by its index

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
indexThe position of this argument
Returns
An optional holding the raw argument which is placed at the given index, or an empty optional if index is invalid

Returns an Optional holding the raw argument by its node name

A raw argument is the String form of an argument as written in a command. For example take this command:

/mycommand @e 15.3

When using this method to access these arguments, @e and 15.3 will be available as Strings and not as a Collection and Double

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
Returns
An optional holding the argument with the specified node name or an empty optional if the node name was not found

Unchecked methods. These are the same as the methods above, but use unchecked generics to conform to the type they are declared as. In Java, the normal methods (checked) require casting:

CommandArguments args = ...; String myString = (String) args.get("target");

However, these unchecked methods don't require casting:

CommandArguments args = ...; String myString = args.getUnchecked("target");

Returns an argument by its position

Parameters
indexThe position of this argument
Returns
An argument which is placed at the given index, or null if the provided index does not point to an argument.

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
Returns
An argument which has the given node name. Can be null if nodeName was not found.

Returns an argument by its index

Parameters
indexThe position of this argument
defaultValueThe Object returned if the argument is not existent
Returns
An argument which is placed at the given index, or the provided default value

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
defaultValueThe Object returned if the argument was not found.
Returns
The argument with the specified node name or the provided default value

Returns an argument by its index

Parameters
indexThe position of this argument
defaultValueThe Object returned if the argument is not existent
Returns
An argument which is placed at the given index, or the provided default value

Returns an argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
defaultValueThe Object returned if the argument was not found.
Returns
The argument with the specified node name or the provided default value

Returns an Optional holding the argument at its index

Parameters
indexThe position of this argument
Returns
An optional holding the argument at its index, or an empty optional if the index was invalid

Returns an Optional holding the argument by its node name

Parameters
nodeNameThe node name of this argument. This was set when initializing an argument
Returns
An optional holding the argument with the specified node name, or an empty optional if the index was invalid
Parameters
args
Thearguments for this command
argsMap
Thearguments for this command mapped to their node names. This is an ordered map
rawArgs
Theraw arguments for this command
rawArgsMap
Theraw arguments for this command mapped to their node names. This is an ordered map
fullInput
Thecommand string a player has entered (including the /)