Package org.bukkit.conversations
Class ConversationContext
java.lang.Object
org.bukkit.conversations.ConversationContext
public class ConversationContext
extends java.lang.Object
A ConversationContext provides continuity between nodes in the prompt graph
by giving the developer access to the subject of the conversation and a
generic map for storing values that are shared between all
Prompt
invocations.-
Constructor Summary
Constructors Constructor Description ConversationContext(Plugin plugin, Conversable forWhom, java.util.Map<java.lang.Object,java.lang.Object> initialSessionData) -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.Object,java.lang.Object>getAllSessionData()Gets the entire sessionData map.ConversablegetForWhom()Gets the subject of the conversation.PlugingetPlugin()Gets the plugin that owns this conversation.java.lang.ObjectgetSessionData(java.lang.Object key)Gets session data shared between allPromptinvocations.voidsetSessionData(java.lang.Object key, java.lang.Object value)Sets session data shared between allPromptinvocations.
-
Constructor Details
-
ConversationContext
public ConversationContext(Plugin plugin, Conversable forWhom, java.util.Map<java.lang.Object,java.lang.Object> initialSessionData)- Parameters:
plugin- The owning plugin.forWhom- The subject of the conversation.initialSessionData- Any initial values to put in the sessionData map.
-
-
Method Details
-
getPlugin
Gets the plugin that owns this conversation.- Returns:
- The owning plugin.
-
getForWhom
Gets the subject of the conversation.- Returns:
- The subject of the conversation.
-
getAllSessionData
public java.util.Map<java.lang.Object,java.lang.Object> getAllSessionData()Gets the entire sessionData map.- Returns:
- The full sessionData map.
-
getSessionData
public java.lang.Object getSessionData(java.lang.Object key)Gets session data shared between allPromptinvocations. Use this as a way to pass data through each Prompt as the conversation develops.- Parameters:
key- The session data key.- Returns:
- The requested session data.
-
setSessionData
public void setSessionData(java.lang.Object key, java.lang.Object value)Sets session data shared between allPromptinvocations. Use this as a way to pass data through each prompt as the conversation develops.- Parameters:
key- The session data key.value- The session data value.
-