Bukkit  1.5.2-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.conversations.ConversationFactory Class Reference

A ConversationFactory is responsible for creating a Conversation from a predefined template. More...

+ Collaboration diagram for org.bukkit.conversations.ConversationFactory:

Public Member Functions

 ConversationFactory (Plugin plugin)
 Constructs a ConversationFactory.
 
ConversationFactory withModality (boolean modal)
 Sets the modality of all Conversations created by this factory.
 
ConversationFactory withLocalEcho (boolean localEchoEnabled)
 Sets the local echo status for all Conversations created by this factory.
 
ConversationFactory withPrefix (ConversationPrefix prefix)
 Sets the ConversationPrefix that prepends all output from all generated conversations.
 
ConversationFactory withTimeout (int timeoutSeconds)
 Sets the number of inactive seconds to wait before automatically abandoning all generated conversations.
 
ConversationFactory withFirstPrompt (Prompt firstPrompt)
 Sets the first prompt to use in all generated conversations.
 
ConversationFactory withInitialSessionData (Map< Object, Object > initialSessionData)
 Sets any initial data with which to populate the conversation context sessionData map.
 
ConversationFactory withEscapeSequence (String escapeSequence)
 Sets the player input that, when received, will immediately terminate the conversation.
 
ConversationFactory withConversationCanceller (ConversationCanceller canceller)
 Adds a to constructed conversations.
 
ConversationFactory thatExcludesNonPlayersWithMessage (String playerOnlyMessage)
 Prevents this factory from creating a conversation for non-player Conversable objects.
 
ConversationFactory addConversationAbandonedListener (ConversationAbandonedListener listener)
 Adds a ConversationAbandonedListener to all conversations constructed by this factory.
 
Conversation buildConversation (Conversable forWhom)
 Constructs a Conversation in accordance with the defaults set for this factory.
 

Protected Attributes

Plugin plugin
 
boolean isModal
 
boolean localEchoEnabled
 
ConversationPrefix prefix
 
Prompt firstPrompt
 
Map< Object, Object > initialSessionData
 
String playerOnlyMessage
 
List< ConversationCancellercancellers
 
List
< ConversationAbandonedListener
abandonedListeners
 

Detailed Description

A ConversationFactory is responsible for creating a Conversation from a predefined template.

A ConversationFactory is typically created when a plugin is instantiated and builds a Conversation each time a user initiates a conversation with the plugin. Each Conversation maintains its own state and calls back as needed into the plugin.

The ConversationFactory implements a fluid API, allowing parameters to be set as an extension to the constructor.

Definition at line 18 of file ConversationFactory.java.

Constructor & Destructor Documentation

Member Function Documentation

ConversationFactory org.bukkit.conversations.ConversationFactory.addConversationAbandonedListener ( ConversationAbandonedListener  listener)

Adds a ConversationAbandonedListener to all conversations constructed by this factory.

Parameters
listenerThe listener to add.
Returns
This object.

Definition at line 152 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.abandonedListeners.

ConversationFactory org.bukkit.conversations.ConversationFactory.thatExcludesNonPlayersWithMessage ( String  playerOnlyMessage)

Prevents this factory from creating a conversation for non-player Conversable objects.

Parameters
playerOnlyMessageThe message to return to a non-play in lieu of starting a conversation.
Returns
This object.

Definition at line 142 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.playerOnlyMessage.

ConversationFactory org.bukkit.conversations.ConversationFactory.withConversationCanceller ( ConversationCanceller  canceller)
ConversationFactory org.bukkit.conversations.ConversationFactory.withEscapeSequence ( String  escapeSequence)

Sets the player input that, when received, will immediately terminate the conversation.

Parameters
escapeSequenceInput to terminate the conversation.
Returns
This object.

Definition at line 122 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.withConversationCanceller().

ConversationFactory org.bukkit.conversations.ConversationFactory.withFirstPrompt ( Prompt  firstPrompt)

Sets the first prompt to use in all generated conversations.

The default is Prompt.END_OF_CONVERSATION.

Parameters
firstPromptThe first prompt.
Returns
This object.

Definition at line 102 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.firstPrompt.

ConversationFactory org.bukkit.conversations.ConversationFactory.withInitialSessionData ( Map< Object, Object >  initialSessionData)

Sets any initial data with which to populate the conversation context sessionData map.

Parameters
initialSessionDataThe conversation context's initial sessionData.
Returns
This object.

Definition at line 112 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.initialSessionData.

ConversationFactory org.bukkit.conversations.ConversationFactory.withLocalEcho ( boolean  localEchoEnabled)

Sets the local echo status for all Conversations created by this factory.

If local echo is enabled, any text submitted to a conversation gets echoed back into the submitter's chat window.

Parameters
localEchoEnabledThe status of local echo.
Returns
This object.

Definition at line 67 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.localEchoEnabled.

ConversationFactory org.bukkit.conversations.ConversationFactory.withModality ( boolean  modal)

Sets the modality of all Conversations created by this factory.

If a conversation is modal, all messages directed to the player are suppressed for the duration of the conversation.

The default is True.

Parameters
modalThe modality of all conversations to be created.
Returns
This object.

Definition at line 55 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.isModal.

ConversationFactory org.bukkit.conversations.ConversationFactory.withPrefix ( ConversationPrefix  prefix)

Sets the ConversationPrefix that prepends all output from all generated conversations.

The default is a NullConversationPrefix;

Parameters
prefixThe ConversationPrefix to use.
Returns
This object.

Definition at line 79 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.prefix.

ConversationFactory org.bukkit.conversations.ConversationFactory.withTimeout ( int  timeoutSeconds)

Sets the number of inactive seconds to wait before automatically abandoning all generated conversations.

The default is 600 seconds (5 minutes).

Parameters
timeoutSecondsThe number of seconds to wait.
Returns
This object.

Definition at line 91 of file ConversationFactory.java.

References org.bukkit.conversations.ConversationFactory.plugin, and org.bukkit.conversations.ConversationFactory.withConversationCanceller().

Member Data Documentation


The documentation for this class was generated from the following file: