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