[Bleeding] Added Conversations API. Addresses BUKKIT-864

By: rmichela <deltahat@gmail.com>
This commit is contained in:
Bukkit/Spigot
2012-01-22 02:35:42 -05:00
parent fb55ed2a78
commit 2280c6be2b
26 changed files with 1446 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
package org.bukkit.conversations;
/**
* An ExactMatchConversationCanceller cancels a conversation if the user enters an exact input string
*/
public class ExactMatchConversationCanceller implements ConversationCanceller {
private String escapeSequence;
/**
* Builds an ExactMatchConversationCanceller.
* @param escapeSequence The string that, if entered by the user, will cancel the conversation.
*/
public ExactMatchConversationCanceller(String escapeSequence) {
this.escapeSequence = escapeSequence;
}
public void setConversation(Conversation conversation) {}
public boolean cancelBasedOnInput(ConversationContext context, String input) {
return input.equals(escapeSequence);
}
public ConversationCanceller clone() {
return new ExactMatchConversationCanceller(escapeSequence);
}
}