Package de.craftsblock.craftsnet.command
Class Command
java.lang.Object
de.craftsblock.craftsnet.command.Command
The
Command class represents a command that can be executed.
It contains information about the command's name and its associated executor.- Since:
- 2.2.0-SNAPSHOT
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an alias to this commandRetrieves the executor associated with this command.getName()Retrieves the name of the command.booleanChecks if the command has an associated executor.booleanChecks if an alias is already present.voidsetExecutor(CommandExecutor executor) Sets the executor for this command.
-
Constructor Details
-
Command
Constructs a newCommandwith the specified name.- Parameters:
name- The name of the command. It uniquely identifies the command.
-
-
Method Details
-
getName
Retrieves the name of the command.- Returns:
- The name of the command, which is a unique identifier.
-
hasExecutor
public boolean hasExecutor()Checks if the command has an associated executor.- Returns:
trueif an executor is set for this command, otherwisefalse.
-
setExecutor
Sets the executor for this command. The executor is responsible for handling the command's logic.- Parameters:
executor- The executor that will handle the execution of this command.
-
getExecutor
Retrieves the executor associated with this command.- Returns:
- The executor for this command, or
nullif no executor is set.
-
addAlias
Adds an alias to this command- Parameters:
alias- The alias which should be added
-
isAlias
Checks if an alias is already present.- Parameters:
alias- The name of the alias which should be checked.- Returns:
- true if the alias is already present, false otherwise.
-