001 package org.bukkit.conversations;
002
003 /**
004 * An ExactMatchConversationCanceller cancels a conversation if the user
005 * enters an exact input string
006 */
007 public class ExactMatchConversationCanceller implements ConversationCanceller {
008 private String escapeSequence;
009
010 /**
011 * Builds an ExactMatchConversationCanceller.
012 *
013 * @param escapeSequence The string that, if entered by the user, will
014 * cancel the conversation.
015 */
016 public ExactMatchConversationCanceller(String escapeSequence) {
017 this.escapeSequence = escapeSequence;
018 }
019
020 public void setConversation(Conversation conversation) {}
021
022 public boolean cancelBasedOnInput(ConversationContext context, String input) {
023 return input.equals(escapeSequence);
024 }
025
026 public ConversationCanceller clone() {
027 return new ExactMatchConversationCanceller(escapeSequence);
028 }
029 }