Class InputPattern.Builder

java.lang.Object
com.pixelmonmod.pixelmon.api.dialogue.InputPattern.Builder
Enclosing class:
InputPattern

public static class InputPattern.Builder extends Object
A builder for the InputPattern.
  • Constructor Details

    • Builder

      protected Builder()
  • Method Details

    • pattern

      public InputPattern.Builder pattern(Pattern pattern)
    • pattern

      public InputPattern.Builder pattern(String pattern)
    • onlyIntegerInput

      public InputPattern.Builder onlyIntegerInput()
      Sets the regex to only accept inputs that are entirely numerical characters.
      Returns:
      This builder.
    • onlyAlphabeticalInput

      public InputPattern.Builder onlyAlphabeticalInput()
      Sets the regex to only accept inputs that are entirely alphabetical characters.
      Returns:
      This builder.
    • onlyAlphabeticalAndSpaceInput

      public InputPattern.Builder onlyAlphabeticalAndSpaceInput()
      Sets the regex to only accept inputs that are only alphabetical characters and spaces.
      Returns:
      This builder.
    • onlyAlphaNumericInput

      public InputPattern.Builder onlyAlphaNumericInput()
      Sets the regex to only accept inputs that are only alphabetical characters, spaces, and numbers.
      Returns:
      This builder.
    • anyInput

      public InputPattern.Builder anyInput()
      Sets the regex to accept any input at all (including none).
      Returns:
      This builder.
    • nonEmptyInput

      public InputPattern.Builder nonEmptyInput()
      Sets the regex to accept any input at all as long as it is not empty.
      Returns:
      This builder.
    • validURL

      public InputPattern.Builder validURL()
      Sets the regex to accept only valid URLs.
      Returns:
      This builder.
    • errorMessage

      public InputPattern.Builder errorMessage(String errorMessage)
      The error message to display when the input is invalid.
      Parameters:
      errorMessage - The error message.
      Returns:
      This builder.
    • errorMessage

      public InputPattern.Builder errorMessage(net.minecraft.network.chat.Component errorMessage)
      The error message to display when the input is invalid.
      Parameters:
      errorMessage - The error message.
      Returns:
      This builder.
    • errorDuration

      public InputPattern.Builder errorDuration(TimeUnit unit, long duration)
      The duration that the error message will display in the display box.
      Parameters:
      unit - The unit of time.
      duration - The duration.
      Returns:
      This builder.
    • errorDuration

      public InputPattern.Builder errorDuration(long errorDuration)
      The duration in milliseconds that the error message will display in the display box.
      Parameters:
      errorDuration - The duration in milliseconds.
      Returns:
      This builder.
    • build

      public InputPattern build()
      Creates the InputPattern from the builder.
      Returns:
      The InputPattern.