Class DoubleArgument.DoubleParser<C>

java.lang.Object
cloud.commandframework.arguments.standard.DoubleArgument.DoubleParser<C>
All Implemented Interfaces:
ArgumentParser<C,Double>
Enclosing class:
DoubleArgument<C>

@API(status=STABLE) public static final class DoubleArgument.DoubleParser<C> extends Object implements ArgumentParser<C,Double>
  • Field Details

    • DEFAULT_MINIMUM

      @API(status=STABLE, since="1.5.0") public static final double DEFAULT_MINIMUM
      Constant for the default/unset minimum value.
      Since:
      1.5.0
      See Also:
    • DEFAULT_MAXIMUM

      @API(status=STABLE, since="1.5.0") public static final double DEFAULT_MAXIMUM
      Constant for the default/unset maximum value.
      Since:
      1.5.0
      See Also:
  • Constructor Details

    • DoubleParser

      public DoubleParser(double min, double max)
      Construct a new double parser
      Parameters:
      min - Minimum value
      max - Maximum value
  • Method Details

    • parse

      public @NonNull ArgumentParseResult<Double> parse(@NonNull CommandContext<C> commandContext, @NonNull Queue<@NonNull String> inputQueue)
      Description copied from interface: ArgumentParser
      Parse command input into a command result.

      This method may be called when a command chain is being parsed for execution (using CommandManager.executeCommand(Object, String)) or when a command is being parsed to provide context for suggestions (using CommandManager.suggest(Object, String)). It is possible to use CommandContext.isSuggestions()} to see what the purpose of the parsing is. Particular care should be taken when parsing for suggestions, as the parsing method is then likely to be called once for every character written by the command sender.

      This method should never throw any exceptions under normal circumstances. Instead, if the parsing for some reason cannot be done successfully ArgumentParseResult.failure(Throwable) should be returned. This then wraps any exception that should be forwarded to the command sender.

      The parser is assumed to be completely stateless and should not store any information about the command sender or the command context. Instead, information should be stored in the CommandContext.

      Specified by:
      parse in interface ArgumentParser<C,Double>
      Parameters:
      commandContext - Command context
      inputQueue - The queue of arguments
      Returns:
      Parsed command result
    • isContextFree

      public boolean isContextFree()
      Description copied from interface: ArgumentParser
      Check whether this argument parser is context free. A context free parser will not use the provided command context, and so supports impromptu parsing
      Specified by:
      isContextFree in interface ArgumentParser<C,Double>
      Returns:
      true if the parser is context free, else false
    • getMax

      public double getMax()
      Get the max value
      Returns:
      Max value
    • getMin

      public double getMin()
      Get the min value
      Returns:
      Min value
    • hasMax

      public boolean hasMax()
      Get whether this parser has a maximum set. This will compare the parser's maximum to DEFAULT_MAXIMUM.
      Returns:
      whether the parser has a maximum set
      Since:
      1.5.0
    • hasMin

      public boolean hasMin()
      Get whether this parser has a minimum set. This will compare the parser's minimum to DEFAULT_MINIMUM.
      Returns:
      whether the parser has a maximum set
      Since:
      1.5.0