Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.conversations.ValidatingPrompt Class Referenceabstract

ValidatingPrompt is the base class for any prompt that requires validation. More...

+ Inheritance diagram for org.bukkit.conversations.ValidatingPrompt:
+ Collaboration diagram for org.bukkit.conversations.ValidatingPrompt:

Public Member Functions

 ValidatingPrompt ()
 
Prompt acceptInput (ConversationContext context, String input)
 Accepts and processes input from the user and validates it.
 
boolean blocksForInput (ConversationContext context)
 Ensures that the prompt waits for the user to provide input.
 
- Public Member Functions inherited from org.bukkit.conversations.Prompt
String getPromptText (ConversationContext context)
 Gets the text to display to the user when this prompt is first presented.
 
boolean blocksForInput (ConversationContext context)
 Checks to see if this prompt implementation should wait for user input or immediately display the next prompt.
 
Prompt acceptInput (ConversationContext context, String input)
 Accepts and processes input from the user.
 

Protected Member Functions

abstract boolean isInputValid (ConversationContext context, String input)
 Override this method to check the validity of the player's input.
 
abstract Prompt acceptValidatedInput (ConversationContext context, String input)
 Override this method to accept and processes the validated input from the user.
 
String getFailedValidationText (ConversationContext context, String invalidInput)
 Optionally override this method to display an additional message if the user enters an invalid input.
 

Additional Inherited Members

- Static Public Attributes inherited from org.bukkit.conversations.Prompt
static final Prompt END_OF_CONVERSATION = null
 A convenience constant for indicating the end of a conversation.
 

Detailed Description

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.

Definition at line 9 of file ValidatingPrompt.java.

Constructor & Destructor Documentation

org.bukkit.conversations.ValidatingPrompt.ValidatingPrompt ( )

Definition at line 10 of file ValidatingPrompt.java.

Member Function Documentation

Prompt org.bukkit.conversations.ValidatingPrompt.acceptInput ( ConversationContext  context,
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.

Parameters
contextContext information about the conversation.
inputThe input text from the user.
Returns
This prompt or the next Prompt in the prompt graph.

Definition at line 21 of file ValidatingPrompt.java.

References org.bukkit.conversations.ValidatingPrompt.acceptValidatedInput(), org.bukkit.conversations.ValidatingPrompt.getFailedValidationText(), org.bukkit.conversations.ConversationContext.getForWhom(), org.bukkit.conversations.ValidatingPrompt.isInputValid(), org.bukkit.ChatColor.RED, and org.bukkit.conversations.Conversable.sendRawMessage().

abstract Prompt org.bukkit.conversations.ValidatingPrompt.acceptValidatedInput ( ConversationContext  context,
String  input 
)
protectedpure virtual

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.

Parameters
contextContext information about the conversation.
inputThe validated input text from the user.
Returns
The next Prompt in the prompt graph.

Implemented in org.bukkit.conversations.NumericPrompt, org.bukkit.conversations.PlayerNamePrompt, and org.bukkit.conversations.BooleanPrompt.

Referenced by org.bukkit.conversations.ValidatingPrompt.acceptInput().

boolean org.bukkit.conversations.ValidatingPrompt.blocksForInput ( ConversationContext  context)

Ensures that the prompt waits for the user to provide input.

Parameters
contextContext information about the conversation.
Returns
True.

Definition at line 39 of file ValidatingPrompt.java.

String org.bukkit.conversations.ValidatingPrompt.getFailedValidationText ( ConversationContext  context,
String  invalidInput 
)
protected

Optionally override this method to display an additional message if the user enters an invalid input.

Parameters
contextContext information about the conversation.
invalidInputThe invalid input provided by the user.
Returns
A message explaining how to correct the input.

Definition at line 66 of file ValidatingPrompt.java.

Referenced by org.bukkit.conversations.ValidatingPrompt.acceptInput().

abstract boolean org.bukkit.conversations.ValidatingPrompt.isInputValid ( ConversationContext  context,
String  input 
)
protectedpure virtual

Override this method to check the validity of the player's input.

Parameters
contextContext information about the conversation.
inputThe player's raw console input.
Returns
True or false depending on the validity of the input.

Implemented in org.bukkit.conversations.FixedSetPrompt, org.bukkit.conversations.RegexPrompt, org.bukkit.conversations.PlayerNamePrompt, org.bukkit.conversations.BooleanPrompt, and org.bukkit.conversations.NumericPrompt.

Referenced by org.bukkit.conversations.ValidatingPrompt.acceptInput().


The documentation for this class was generated from the following file: