类 ValidatingPrompt
java.lang.Object
org.bukkit.conversations.ValidatingPrompt
ValidatingPrompt 是任何需要验证的提示的基类。ValidatingPrompt 将不断重放提示文本,直到用户输入有效的响应。
-
字段概要
从接口继承的字段 org.bukkit.conversations.Prompt
END_OF_CONVERSATION -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明acceptInput(@NotNull ConversationContext context, @Nullable String input) 接受并处理来自用户的输入并进行验证。acceptValidatedInput(@NotNull ConversationContext context, @NotNull String input) 覆盖此方法以接受并处理来自用户的验证输入。booleanblocksForInput(@NotNull ConversationContext context) 确保提示等待用户提供输入。getFailedValidationText(@NotNull ConversationContext context, @NotNull String invalidInput) 可选择覆盖此方法以在用户输入无效输入时显示额外消息。protected abstract booleanisInputValid(@NotNull ConversationContext context, @NotNull String 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) 接受并处理来自用户的输入并进行验证。如果验证失败,返回此提示以重新执行,否则返回提示图中的下一个 Prompt。原文: 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- 关于对话的上下文信息。input- 来自用户的输入文本。- 返回:
- 此提示或提示图中的下一个 Prompt。
-
blocksForInput
确保提示等待用户提供输入。原文: Ensures that the prompt waits for the user to provide input.
- 指定者:
blocksForInput在接口中Prompt- 参数:
context- 关于对话的上下文信息。- 返回:
- 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- 关于对话的上下文信息。input- 玩家的原始控制台输入。- 返回:
- 根据输入的有效性返回 true 或 false。
-
acceptValidatedInput
@Nullable protected abstract @Nullable Prompt acceptValidatedInput(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String input) 覆盖此方法以接受并处理来自用户的验证输入。使用输入,应返回提示图中的下一个 Prompt。原文: 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- 关于对话的上下文信息。input- 来自用户的验证输入文本。- 返回:
- 提示图中的下一个 Prompt。
-
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- 关于对话的上下文信息。invalidInput- 用户提供的无效输入。- 返回:
- 解释如何纠正输入的消息。
-