Class CommandRegistry

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

public class CommandRegistry extends Object
The CommandRegistry class manages and provides access to registered commands. It allows commands to be retrieved, checked for existence, and executed.
Since:
2.2.0-SNAPSHOT
See Also:
  • Constructor Details

    • CommandRegistry

      public CommandRegistry(CraftsNet craftsNet)
      Constructs a new instance of the command registry.
      Parameters:
      craftsNet - The CraftsNet instance which instantiates this command registry.
  • Method Details

    • getCommand

      @NotNull public @NotNull Command getCommand(String name)
      Retrieves a command by name. If the command doesn't exist, it is created.
      Parameters:
      name - The name of the command to retrieve.
      Returns:
      The command with the specified name or a new command if it doesn't exist.
    • hasCommand

      public boolean hasCommand(String name)
      Checks if a command with the given name exists.
      Parameters:
      name - The name of the command to check for existence.
      Returns:
      true if a command with the specified name exists, otherwise false.
    • perform

      public void perform(String name, String[] args)
      Performs the execution of a command with the provided name and arguments.
      Parameters:
      name - The name of the command to execute.
      args - The arguments to pass to the command executor.