001    package org.bukkit.conversations;
002    
003    /**
004     * A Prompt is the main constituent of a {@link Conversation}. Each prompt displays text to the user and optionally
005     * waits for a user's response. Prompts are chained together into a directed graph that represents the conversation
006     * flow. To halt a conversation, END_OF_CONVERSATION is returned in liu of another Prompt object.
007     */
008    public interface Prompt extends Cloneable {
009    
010        /**
011         * A convenience constant for indicating the end of a conversation.
012         */
013        static final Prompt END_OF_CONVERSATION = null;
014    
015        /**
016         * Gets the text to display to the user when this prompt is first presented.
017         * @param context Context information about the conversation.
018         * @return The text to display.
019         */
020        String getPromptText(ConversationContext context);
021    
022        /**
023         * Checks to see if this prompt implementation should wait for user input or immediately display the next prompt.
024         * @param context Context information about the conversation.
025         * @return If true, the {@link Conversation} will wait for input before continuing.
026         */
027        boolean blocksForInput(ConversationContext context);
028    
029        /**
030         * Accepts and processes input from the user. Using the input, the next Prompt in the prompt graph is returned.
031         * @param context Context information about the conversation.
032         * @param input The input text from the user.
033         * @return The next Prompt in the prompt graph.
034         */
035        Prompt acceptInput(ConversationContext context, String input);
036    }