Class Conversation
ConversationFactory is used to
 construct identical conversations on demand.
 
 Conversation flow consists of a directed graph of Prompt objects.
 Each time a prompt gets input from the user, it must return the next prompt
 in the graph. Since each Prompt chooses the next Prompt, complex
 conversation trees can be implemented where the nature of the player's
 response directs the flow of the conversation.
 
 Each conversation has a ConversationPrefix that prepends all output
 from the conversation to the player. The ConversationPrefix can be used to
 display the plugin name or conversation status as the conversation evolves.
 
Each conversation has a timeout measured in the number of inactive seconds to wait before abandoning the conversation. If the inactivity timeout is reached, the conversation is abandoned and the user's incoming and outgoing chat is returned to normal.
 You should not construct a conversation manually. Instead, use the ConversationFactory for access to all available options.
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected List<ConversationAbandonedListener> protected List<ConversationCanceller> protected ConversationContextprotected Promptprotected booleanprotected booleanprotected ConversationPrefix
- 
Constructor SummaryConstructorsConstructorDescriptionConversation(@Nullable Plugin plugin, @NotNull Conversable forWhom, @Nullable Prompt firstPrompt) Initializes a new Conversation.Conversation(@Nullable Plugin plugin, @NotNull Conversable forWhom, @Nullable Prompt firstPrompt, @NotNull Map<Object, Object> initialSessionData) Initializes a new Conversation.
- 
Method SummaryModifier and TypeMethodDescriptionvoidabandon()Abandons and resets the current conversation.voidabandon(@NotNull ConversationAbandonedEvent details) Abandons and resets the current conversation.voidacceptInput(@NotNull String input) Passes player input into the current prompt.voidAdds aConversationAbandonedListener.voidbegin()Displays the first prompt of this conversation and begins redirecting the user's chat responses.Gets the list ofConversationCancellersReturns the Conversation'sConversationContext.Gets the entity for whom this conversation is mediating.Gets theConversationPrefixthat prepends all output from this conversation.getState()Returns Returns the current state of the conversation.booleanGets the status of local echo for this conversation.booleanisModal()Gets the modality of this conversation.voidDisplays the next user prompt and abandons the conversation if the next prompt is null.voidRemoves aConversationAbandonedListener.voidsetLocalEchoEnabled(boolean localEchoEnabled) Sets the status of local echo for this conversation.
- 
Field Details- 
currentPrompt
- 
context
- 
modalprotected boolean modal
- 
localEchoEnabledprotected boolean localEchoEnabled
- 
prefix
- 
cancellers
- 
abandonedListeners
 
- 
- 
Constructor Details- 
Conversationpublic Conversation(@Nullable @Nullable Plugin plugin, @NotNull @NotNull Conversable forWhom, @Nullable @Nullable Prompt firstPrompt) Initializes a new Conversation.- Parameters:
- plugin- The plugin that owns this conversation.
- forWhom- The entity for whom this conversation is mediating.
- firstPrompt- The first prompt in the conversation graph.
 
- 
Conversationpublic Conversation(@Nullable @Nullable Plugin plugin, @NotNull @NotNull Conversable forWhom, @Nullable @Nullable Prompt firstPrompt, @NotNull @NotNull Map<Object, Object> initialSessionData) Initializes a new Conversation.- Parameters:
- plugin- The plugin that owns this conversation.
- forWhom- The entity for whom this conversation is mediating.
- firstPrompt- The first prompt in the conversation graph.
- initialSessionData- Any initial values to put in the conversation context sessionData map.
 
 
- 
- 
Method Details- 
getForWhomGets the entity for whom this conversation is mediating.- Returns:
- The entity.
 
- 
isModalpublic boolean isModal()Gets the modality of this conversation. If a conversation is modal, all messages directed to the player are suppressed for the duration of the conversation.- Returns:
- The conversation modality.
 
- 
isLocalEchoEnabledpublic boolean isLocalEchoEnabled()Gets the status of local echo for this conversation. If local echo is enabled, any text submitted to a conversation gets echoed back into the submitter's chat window.- Returns:
- The status of local echo.
 
- 
setLocalEchoEnabledpublic void setLocalEchoEnabled(boolean localEchoEnabled) Sets the status of local echo for this conversation. If local echo is enabled, any text submitted to a conversation gets echoed back into the submitter's chat window.- Parameters:
- localEchoEnabled- The status of local echo.
 
- 
getPrefixGets theConversationPrefixthat prepends all output from this conversation.- Returns:
- The ConversationPrefix in use.
 
- 
getCancellersGets the list ofConversationCancellers- Returns:
- The list.
 
- 
getContextReturns the Conversation'sConversationContext.- Returns:
- The ConversationContext.
 
- 
beginpublic void begin()Displays the first prompt of this conversation and begins redirecting the user's chat responses.
- 
getStateReturns Returns the current state of the conversation.- Returns:
- The current state of the conversation.
 
- 
acceptInputPasses player input into the current prompt. The next prompt (as determined by the current prompt) is then displayed to the user.- Parameters:
- input- The user's chat text.
 
- 
addConversationAbandonedListenerpublic void addConversationAbandonedListener(@NotNull @NotNull ConversationAbandonedListener listener) Adds aConversationAbandonedListener.- Parameters:
- listener- The listener to add.
 
- 
removeConversationAbandonedListenerpublic void removeConversationAbandonedListener(@NotNull @NotNull ConversationAbandonedListener listener) Removes aConversationAbandonedListener.- Parameters:
- listener- The listener to remove.
 
- 
abandonpublic void abandon()Abandons and resets the current conversation. Restores the user's normal chat behavior.
- 
abandonAbandons and resets the current conversation. Restores the user's normal chat behavior.- Parameters:
- details- Details about why the conversation was abandoned
 
- 
outputNextPromptpublic void outputNextPrompt()Displays the next user prompt and abandons the conversation if the next prompt is null.
 
-