Class ArgumentString

java.lang.Object
net.minestom.server.command.builder.arguments.Argument<java.lang.String>
net.minestom.server.command.builder.arguments.ArgumentString

public class ArgumentString
extends Argument<java.lang.String>
Argument which will take a quoted string.

Example: "Hey I am a string"

  • Field Details

  • Constructor Details

  • Method Details

    • getCorrectionResult

      public int getCorrectionResult​(@NotNull java.lang.String value)
      Description copied from class: Argument
      First method called to check the validity of an input.

      If Argument.allowSpace() is enabled, the value will be incremented by the next word until it returns Argument.SUCCESS, meaning that you need to be sure to check the inexpensive operations first (eg the number of brackets, the first and last char, etc...).

      Specified by:
      getCorrectionResult in class Argument<java.lang.String>
      Parameters:
      value - The received argument
      Returns:
      the error code or Argument.SUCCESS
    • parse

      @NotNull public java.lang.String parse​(@NotNull java.lang.String value)
      Description copied from class: Argument
      Called after Argument.getCorrectionResult(String) returned Argument.SUCCESS.

      The correction being correct means that value shouldn't be verified again, you can assume that no exception will occur when converting it to the correct type.

      Specified by:
      parse in class Argument<java.lang.String>
      Parameters:
      value - The correct argument which does not need to be verified again
      Returns:
      The parsed argument
    • getConditionResult

      public int getConditionResult​(@NotNull java.lang.String value)
      Description copied from class: Argument
      Called after Argument.parse(String) meaning that value should already represent a valid representation of the input.

      The condition result has for goal to check the optional conditions that are user configurable (eg min/max values for a number, a specific material for an item, etc...).

      Specified by:
      getConditionResult in class Argument<java.lang.String>
      Parameters:
      value - The parsed argument
      Returns:
      the error code or Argument.SUCCESS