/** * Passes player input into the current prompt. The next prompt (as determined by the current * prompt) is then displayed to the user. * * @param input The user's chat text. */ public void acceptInput(String input) { if (currentPrompt != null) { // Echo the user's input if (localEchoEnabled) { context.getForWhom().sendRawMessage(prefix.getPrefix(context) + input); } // Test for conversation abandonment based on input for (ConversationCanceller canceller : cancellers) { if (canceller.cancelBasedOnInput(context, input)) { abandon(new ConversationAbandonedEvent(this, canceller)); return; } } // Not abandoned, output the next prompt currentPrompt = currentPrompt.acceptInput(context, input); outputNextPrompt(); } }
/** * Adds a {@link ConversationCanceller} to the cancellers collection. * * @param canceller The {@link ConversationCanceller} to add. */ void addConversationCanceller(ConversationCanceller canceller) { canceller.setConversation(this); this.cancellers.add(canceller); }