BooleanPrompt, FixedSetPrompt, NumericPrompt, PlayerNamePrompt, RegexPromptpublic abstract class ValidatingPrompt extends Object implements Prompt
END_OF_CONVERSATION| Constructor | Description |
|---|---|
ValidatingPrompt() |
| Modifier and Type | Method | Description |
|---|---|---|
@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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPromptText@Nullable public @Nullable Prompt acceptInput(@NotNull @NotNull ConversationContext context, @Nullable @Nullable String input)
acceptInput in interface Promptcontext - Context information about the conversation.input - The input text from the user.public boolean blocksForInput(@NotNull
@NotNull ConversationContext context)
blocksForInput in interface Promptcontext - Context information about the conversation.protected abstract boolean isInputValid(@NotNull
@NotNull ConversationContext context,
@NotNull
@NotNull String input)
context - Context information about the conversation.input - The player's raw console input.@Nullable protected abstract @Nullable Prompt acceptValidatedInput(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String input)
context - Context information about the conversation.input - The validated input text from the user.@Nullable protected @Nullable String getFailedValidationText(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String invalidInput)
context - Context information about the conversation.invalidInput - The invalid input provided by the user.Copyright © 2020. All rights reserved.