Class Command

java.lang.Object
de.craftsblock.craftsnet.command.Command

public class Command extends Object
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 Details

    • Command

      public Command(String name)
      Constructs a new Command with the specified name.
      Parameters:
      name - The name of the command. It uniquely identifies the command.
  • Method Details

    • getName

      public String 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:
      true if an executor is set for this command, otherwise false.
    • setExecutor

      public void setExecutor(CommandExecutor executor)
      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

      public CommandExecutor getExecutor()
      Retrieves the executor associated with this command.
      Returns:
      The executor for this command, or null if no executor is set.
    • addAlias

      public void addAlias(String... alias)
      Adds an alias to this command
      Parameters:
      alias - The alias which should be added
    • isAlias

      public boolean isAlias(String alias)
      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.