Package org.bukkit.conversations
Class ConversationFactory
java.lang.Object
org.bukkit.conversations.ConversationFactory
Deprecated, for removal: This API element is subject to removal in a future version.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<ConversationAbandonedListener> Deprecated, for removal: This API element is subject to removal in a future version.protected List
<ConversationCanceller> Deprecated, for removal: This API element is subject to removal in a future version.protected Prompt
Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.protected boolean
Deprecated, for removal: This API element is subject to removal in a future version.protected boolean
Deprecated, for removal: This API element is subject to removal in a future version.protected String
Deprecated, for removal: This API element is subject to removal in a future version.protected Plugin
Deprecated, for removal: This API element is subject to removal in a future version.protected ConversationPrefix
Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionConversationFactory
(@NotNull Plugin plugin) Deprecated, for removal: This API element is subject to removal in a future version.Constructs a ConversationFactory. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Adds aConversationAbandonedListener
to all conversations constructed by this factory.buildConversation
(@NotNull Conversable forWhom) Deprecated, for removal: This API element is subject to removal in a future version.Constructs aConversation
in accordance with the defaults set for this factory.thatExcludesNonPlayersWithMessage
(@Nullable String playerOnlyMessage) Deprecated, for removal: This API element is subject to removal in a future version.Prevents this factory from creating a conversation for non-playerConversable
objects.Deprecated, for removal: This API element is subject to removal in a future version.Adds aConversationCanceller
to constructed conversations.withEscapeSequence
(@NotNull String escapeSequence) Deprecated, for removal: This API element is subject to removal in a future version.Sets the player input that, when received, will immediately terminate the conversation.withFirstPrompt
(@Nullable Prompt firstPrompt) Deprecated, for removal: This API element is subject to removal in a future version.Sets the first prompt to use in all generated conversations.withInitialSessionData
(@NotNull Map<Object, Object> initialSessionData) Deprecated, for removal: This API element is subject to removal in a future version.Sets any initial data with which to populate the conversation context sessionData map.withLocalEcho
(boolean localEchoEnabled) Deprecated, for removal: This API element is subject to removal in a future version.Sets the local echo status for allConversation
s created by this factory.withModality
(boolean modal) Deprecated, for removal: This API element is subject to removal in a future version.Sets the modality of allConversation
s created by this factory.withPrefix
(@NotNull ConversationPrefix prefix) Deprecated, for removal: This API element is subject to removal in a future version.Sets theConversationPrefix
that prepends all output from all generated conversations.withTimeout
(int timeoutSeconds) Deprecated, for removal: This API element is subject to removal in a future version.Sets the number of inactive seconds to wait before automatically abandoning all generated conversations.
-
Field Details
-
plugin
Deprecated, for removal: This API element is subject to removal in a future version. -
isModal
protected boolean isModalDeprecated, for removal: This API element is subject to removal in a future version. -
localEchoEnabled
protected boolean localEchoEnabledDeprecated, for removal: This API element is subject to removal in a future version. -
prefix
Deprecated, for removal: This API element is subject to removal in a future version. -
firstPrompt
Deprecated, for removal: This API element is subject to removal in a future version. -
initialSessionData
Deprecated, for removal: This API element is subject to removal in a future version. -
playerOnlyMessage
Deprecated, for removal: This API element is subject to removal in a future version. -
cancellers
Deprecated, for removal: This API element is subject to removal in a future version. -
abandonedListeners
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
ConversationFactory
Deprecated, for removal: This API element is subject to removal in a future version.Constructs a ConversationFactory.- Parameters:
plugin
- The plugin that owns the factory.
-
-
Method Details
-
withModality
Deprecated, for removal: This API element is subject to removal in a future version.Sets the modality of allConversation
s 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:
modal
- The modality of all conversations to be created.- Returns:
- This object.
-
withLocalEcho
Deprecated, for removal: This API element is subject to removal in a future version.Sets the local echo status for allConversation
s 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:
localEchoEnabled
- The status of local echo.- Returns:
- This object.
-
withPrefix
@NotNull public @NotNull ConversationFactory withPrefix(@NotNull @NotNull ConversationPrefix prefix) Deprecated, for removal: This API element is subject to removal in a future version.Sets theConversationPrefix
that prepends all output from all generated conversations.The default is a
NullConversationPrefix
;- Parameters:
prefix
- The ConversationPrefix to use.- Returns:
- This object.
-
withTimeout
Deprecated, for removal: This API element is subject to removal in a future version.Sets the number of inactive seconds to wait before automatically abandoning all generated conversations.The default is 600 seconds (5 minutes).
- Parameters:
timeoutSeconds
- The number of seconds to wait.- Returns:
- This object.
-
withFirstPrompt
@NotNull public @NotNull ConversationFactory withFirstPrompt(@Nullable @Nullable Prompt firstPrompt) Deprecated, for removal: This API element is subject to removal in a future version.Sets the first prompt to use in all generated conversations.The default is Prompt.END_OF_CONVERSATION.
- Parameters:
firstPrompt
- The first prompt.- Returns:
- This object.
-
withInitialSessionData
@NotNull public @NotNull ConversationFactory withInitialSessionData(@NotNull @NotNull Map<Object, Object> initialSessionData) Deprecated, for removal: This API element is subject to removal in a future version.Sets any initial data with which to populate the conversation context sessionData map.- Parameters:
initialSessionData
- The conversation context's initial sessionData.- Returns:
- This object.
-
withEscapeSequence
@NotNull public @NotNull ConversationFactory withEscapeSequence(@NotNull @NotNull String escapeSequence) Deprecated, for removal: This API element is subject to removal in a future version.Sets the player input that, when received, will immediately terminate the conversation.- Parameters:
escapeSequence
- Input to terminate the conversation.- Returns:
- This object.
-
withConversationCanceller
@NotNull public @NotNull ConversationFactory withConversationCanceller(@NotNull @NotNull ConversationCanceller canceller) Deprecated, for removal: This API element is subject to removal in a future version.Adds aConversationCanceller
to constructed conversations.- Parameters:
canceller
- TheConversationCanceller
to add.- Returns:
- This object.
-
thatExcludesNonPlayersWithMessage
@NotNull public @NotNull ConversationFactory thatExcludesNonPlayersWithMessage(@Nullable @Nullable String playerOnlyMessage) Deprecated, for removal: This API element is subject to removal in a future version.Prevents this factory from creating a conversation for non-playerConversable
objects.- Parameters:
playerOnlyMessage
- The message to return to a non-play in lieu of starting a conversation.- Returns:
- This object.
-
addConversationAbandonedListener
@NotNull public @NotNull ConversationFactory addConversationAbandonedListener(@NotNull @NotNull ConversationAbandonedListener listener) Deprecated, for removal: This API element is subject to removal in a future version.Adds aConversationAbandonedListener
to all conversations constructed by this factory.- Parameters:
listener
- The listener to add.- Returns:
- This object.
-
buildConversation
Deprecated, for removal: This API element is subject to removal in a future version.Constructs aConversation
in accordance with the defaults set for this factory.- Parameters:
forWhom
- The entity for whom the new conversation is mediating.- Returns:
- A new conversation.
-
AsyncChatEvent
or alternatively usingDialog
to get user input.