001 package org.bukkit.conversations;
002
003 /**
004 * A ConversationCanceller is a class that cancels an active {@link
005 * Conversation}. A Conversation can have more than one ConversationCanceller.
006 */
007 public interface ConversationCanceller extends Cloneable {
008
009 /**
010 * Sets the conversation this ConversationCanceller can optionally cancel.
011 *
012 * @param conversation A conversation.
013 */
014 public void setConversation(Conversation conversation);
015
016 /**
017 * Cancels a conversation based on user input.
018 *
019 * @param context Context information about the conversation.
020 * @param input The input text from the user.
021 * @return True to cancel the conversation, False otherwise.
022 */
023 public boolean cancelBasedOnInput(ConversationContext context, String input);
024
025 /**
026 * Allows the {@link ConversationFactory} to duplicate this
027 * ConversationCanceller when creating a new {@link Conversation}.
028 * <p>
029 * Implementing this method should reset any internal object state.
030 *
031 * @return A clone.
032 */
033 public ConversationCanceller clone();
034 }