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