Interface Command


public interface Command
Represents a command in the Spigot plugin framework. Provides methods for command execution, argument handling, and error management.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.github.jwdeveloper.spigot.commands.api.argumetns.ArgumentProperties>
    Retrieves the list of arguments associated with this command.
    child(String name)
    Retrieves a child command by its name, if it exists.
    Retrieves the list of child commands associated with this command.
    io.github.jwdeveloper.dependance.api.DependanceContainer
    Retrieves the DependanceContainer associated with this command, which manages dependencies and services.
    void
    dispatchError(io.github.jwdeveloper.spigot.commands.api.data.events.CommandErrorEvent errorEvent)
    Handles and dispatches errors that occur during command execution.
    default io.github.jwdeveloper.spigot.commands.api.data.ActionResult<io.github.jwdeveloper.spigot.commands.api.data.events.CommandEvent>
    executeCommand(String... arguments)
    Executes the command with the specified arguments from the console sender.
    io.github.jwdeveloper.spigot.commands.api.data.ActionResult<io.github.jwdeveloper.spigot.commands.api.data.events.CommandEvent>
    executeCommand(org.bukkit.command.CommandSender sender, String commandLabel, String... arguments)
    Executes the command with the specified sender, command label, and arguments.
    io.github.jwdeveloper.spigot.commands.api.data.ActionResult<List<String>>
    executeSuggestions(org.bukkit.command.CommandSender sender, String alias, String... args)
    Provides suggestions for command completion based on the sender, alias, and input arguments.
    boolean
    Checks if the command has a child command with the specified name.
    boolean
    Checks if this command has a parent command.
    Retrieves the name of the command.
    Retrieves the parent command of this command, if it exists.
    io.github.jwdeveloper.spigot.commands.api.data.CommandProperties
    Retrieves the properties associated with this command, including name, description, and permissions.
  • Method Details

    • properties

      io.github.jwdeveloper.spigot.commands.api.data.CommandProperties properties()
      Retrieves the properties associated with this command, including name, description, and permissions.
      Returns:
      the CommandProperties of the command
    • arguments

      List<io.github.jwdeveloper.spigot.commands.api.argumetns.ArgumentProperties> arguments()
      Retrieves the list of arguments associated with this command.
      Returns:
      a list of ArgumentProperties defining the command's arguments
    • children

      List<Command> children()
      Retrieves the list of child commands associated with this command.
      Returns:
      a list of child Command objects
    • hasChild

      boolean hasChild(String name)
      Checks if the command has a child command with the specified name.
      Parameters:
      name - the name of the child command
      Returns:
      true if a child command with the specified name exists, false otherwise
    • child

      Optional<Command> child(String name)
      Retrieves a child command by its name, if it exists.
      Parameters:
      name - the name of the child command
      Returns:
      an Optional containing the child command if found, or empty if not found
    • executeCommand

      io.github.jwdeveloper.spigot.commands.api.data.ActionResult<io.github.jwdeveloper.spigot.commands.api.data.events.CommandEvent> executeCommand(org.bukkit.command.CommandSender sender, String commandLabel, String... arguments)
      Executes the command with the specified sender, command label, and arguments.
      Parameters:
      sender - the CommandSender who issued the command
      commandLabel - the label of the command being executed
      arguments - the arguments passed to the command
      Returns:
      an ActionResult containing the CommandEvent of the command execution
    • executeCommand

      default io.github.jwdeveloper.spigot.commands.api.data.ActionResult<io.github.jwdeveloper.spigot.commands.api.data.events.CommandEvent> executeCommand(String... arguments)
      Executes the command with the specified arguments from the console sender.
      Parameters:
      arguments - the arguments passed to the command
      Returns:
      an ActionResult containing the CommandEvent of the command execution
    • executeSuggestions

      io.github.jwdeveloper.spigot.commands.api.data.ActionResult<List<String>> executeSuggestions(org.bukkit.command.CommandSender sender, String alias, String... args)
      Provides suggestions for command completion based on the sender, alias, and input arguments.
      Parameters:
      sender - the CommandSender requesting suggestions
      alias - the alias of the command being used
      args - the arguments entered by the user so far
      Returns:
      an ActionResult containing a list of suggested strings
    • parent

      Optional<Command> parent()
      Retrieves the parent command of this command, if it exists.
      Returns:
      an Optional containing the parent command if available, or empty if no parent exists
    • hasParent

      boolean hasParent()
      Checks if this command has a parent command.
      Returns:
      true if a parent command exists, false otherwise
    • name

      String name()
      Retrieves the name of the command.
      Returns:
      the name of the command as a string
    • container

      io.github.jwdeveloper.dependance.api.DependanceContainer container()
      Retrieves the DependanceContainer associated with this command, which manages dependencies and services.
      Returns:
      the associated DependanceContainer
    • dispatchError

      void dispatchError(io.github.jwdeveloper.spigot.commands.api.data.events.CommandErrorEvent errorEvent)
      Handles and dispatches errors that occur during command execution.
      Parameters:
      errorEvent - the CommandErrorEvent containing details of the error