Class MagicCommand.Builder<S>

java.lang.Object
dev.ua.theroer.magicutils.commands.MagicCommand.Builder<S>
Type Parameters:
S - sender type
Enclosing class:
MagicCommand

public static final class MagicCommand.Builder<S> extends Object
Builder API that produces a concrete MagicCommand.
  • Method Details

    • description

      public MagicCommand.Builder<S> description(String description)
      Sets the command description.
      Parameters:
      description - description text
      Returns:
      this builder
    • aliases

      public MagicCommand.Builder<S> aliases(String... aliases)
      Sets the command aliases.
      Parameters:
      aliases - list of aliases
      Returns:
      this builder
    • permission

      public MagicCommand.Builder<S> permission(String permission)
      Sets the required permission node.
      Parameters:
      permission - permission node
      Returns:
      this builder
    • permissionDefault

      public MagicCommand.Builder<S> permissionDefault(MagicPermissionDefault permissionDefault)
      Sets the default permission state.
      Parameters:
      permissionDefault - default permission
      Returns:
      this builder
    • threading

      public MagicCommand.Builder<S> threading(CommandThreading threading)
      Sets the execution threading mode.
      Parameters:
      threading - execution threading mode
      Returns:
      this builder
    • argument

      public MagicCommand.Builder<S> argument(CommandArgument argument)
      Adds a command argument.
      Parameters:
      argument - command argument
      Returns:
      this builder
    • arguments

      public MagicCommand.Builder<S> arguments(List<CommandArgument> arguments)
      Sets the list of command arguments.
      Parameters:
      arguments - list of arguments
      Returns:
      this builder
    • execute

      public MagicCommand.Builder<S> execute(CommandExecutor<S> executor)
      Sets the command executor.
      Parameters:
      executor - command executor
      Returns:
      this builder
    • subCommand

      public MagicCommand.Builder<S> subCommand(SubCommandSpec<S> subCommand)
      Adds a subcommand.
      Parameters:
      subCommand - subcommand specification
      Returns:
      this builder
    • mount

      public MagicCommand.Builder<S> mount(MagicCommand command)
      Mounts another MagicCommand to this command.
      Parameters:
      command - command to mount
      Returns:
      this builder
    • mount

      public MagicCommand.Builder<S> mount(String route, MagicCommand command)
      Mounts another MagicCommand to a specific sub-path.
      Parameters:
      route - sub-path route
      command - command to mount
      Returns:
      this builder
    • buildSpec

      public CommandSpec<S> buildSpec()
      Builds the command specification.
      Returns:
      command specification
    • build

      public MagicCommand build()
      Builds the MagicCommand instance.
      Returns:
      MagicCommand instance