程序包 org.bukkit.conversations

# 类 ValidatingPrompt

java.lang.Object
org.bukkit.conversations.ValidatingPrompt

所有已实现的接口:
  `Cloneable`, `Prompt`

直接已知子类:
  `BooleanPrompt`, `FixedSetPrompt`, `NumericPrompt`, `PlayerNamePrompt`, `RegexPrompt`

public abstract class ValidatingPrompt extends Object implements Prompt
ValidatingPrompt is the base class for any prompt that requires validation. ValidatingPrompt will keep replaying the prompt text until the user enters a valid response.

- ## 字段概要

  ### 从接口继承的字段 org.bukkit.conversations.Prompt

  `END_OF_CONVERSATION`

- ## 构造器概要

  构造器
  构造器
  说明
  `ValidatingPrompt()`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@Nullable Prompt`
  `acceptInput(@NotNull ConversationContext context, @Nullable String input)`
  Accepts and processes input from the user and validates it.
  `protected abstract @Nullable Prompt`
  `acceptValidatedInput(@NotNull ConversationContext context, @NotNull String input)`
  Override this method to accept and processes the validated input from the user.
  `boolean`
  `blocksForInput(@NotNull ConversationContext context)`
  Ensures that the prompt waits for the user to provide input.
  `protected @Nullable String`
  `getFailedValidationText(@NotNull ConversationContext context, @NotNull String invalidInput)`
  Optionally override this method to display an additional message if the user enters an invalid input.
  `protected abstract boolean`
  `isInputValid(@NotNull ConversationContext context, @NotNull String input)`
  Override this method to check the validity of the player's input.

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### 从接口继承的方法 org.bukkit.conversations.Prompt

  `getPromptText`

- ## 构造器详细资料

  - ### ValidatingPrompt

    public ValidatingPrompt()

- ## 方法详细资料

  - ### acceptInput

    @Nullable public @Nullable Prompt acceptInput(@NotNull @NotNull ConversationContext context, @Nullable @Nullable String input)
    Accepts and processes input from the user and validates it. If validation fails, this prompt is returned for re-execution, otherwise the next Prompt in the prompt graph is returned.
    指定者:
      `acceptInput` 在接口中 `Prompt`
    参数:
      `context` - Context information about the conversation.
      `input` - The input text from the user.
    返回:
      This prompt or the next Prompt in the prompt graph.

  - ### blocksForInput

    public boolean blocksForInput(@NotNull @NotNull ConversationContext context)
    Ensures that the prompt waits for the user to provide input.
    指定者:
      `blocksForInput` 在接口中 `Prompt`
    参数:
      `context` - Context information about the conversation.
    返回:
      True.

  - ### isInputValid

    protected abstract boolean isInputValid(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String input)
    Override this method to check the validity of the player's input.
    参数:
      `context` - Context information about the conversation.
      `input` - The player's raw console input.
    返回:
      True or false depending on the validity of the input.

  - ### acceptValidatedInput

    @Nullable protected abstract @Nullable Prompt acceptValidatedInput(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String input)
    Override this method to accept and processes the validated input from the user. Using the input, the next Prompt in the prompt graph should be returned.
    参数:
      `context` - Context information about the conversation.
      `input` - The validated input text from the user.
    返回:
      The next Prompt in the prompt graph.

  - ### getFailedValidationText

    @Nullable protected @Nullable String getFailedValidationText(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String invalidInput)
    Optionally override this method to display an additional message if the user enters an invalid input.
    参数:
      `context` - Context information about the conversation.
      `invalidInput` - The invalid input provided by the user.
    返回:
      A message explaining how to correct the input.