Class CommandExecution<S>

java.lang.Object
dev.ua.theroer.magicutils.commands.CommandExecution<S>
Type Parameters:
S - sender type

public final class CommandExecution<S> extends Object
Execution context for runtime-defined command actions.
  • Method Details

    • command

      public MagicCommand command()
      Returns the command instance.
      Returns:
      command instance
    • commandName

      public String commandName()
      Returns the root command name.
      Returns:
      command name
    • subCommandName

      public String subCommandName()
      Returns the subcommand name if present.
      Returns:
      subcommand path (space-separated) or null
    • sender

      public S sender()
      Returns the sender instance.
      Returns:
      sender
    • rawArgs

      public List<String> rawArgs()
      Returns raw arguments as an immutable list.
      Returns:
      raw argument list
    • arguments

      public List<CommandArgument> arguments()
      Returns argument descriptors as an immutable list.
      Returns:
      argument descriptors
    • parsedArgs

      public Object[] parsedArgs()
      Returns parsed arguments.
      Returns:
      parsed arguments array
    • arg

      public Object arg(int index)
      Returns the parsed argument at the index.
      Parameters:
      index - argument index
      Returns:
      argument value or null
    • arg

      public <T> T arg(int index, Class<T> type)
      Returns the parsed argument at the index with type checking.
      Type Parameters:
      T - type parameter
      Parameters:
      index - argument index
      type - expected type
      Returns:
      typed value or null
    • arg

      public Object arg(String name)
      Returns the parsed argument by name.
      Parameters:
      name - argument name
      Returns:
      argument value or null
    • arg

      public <T> T arg(String name, Class<T> type)
      Returns the parsed argument by name with type checking.
      Type Parameters:
      T - type parameter
      Parameters:
      name - argument name
      type - expected type
      Returns:
      typed value or null
    • hasArg

      public boolean hasArg(String name)
      Returns true if an argument value exists by name.
      Parameters:
      name - argument name
      Returns:
      true if argument is present
    • toString

      public String toString()
      Overrides:
      toString in class Object