Class ConversationHandler
java.lang.Object
com.jackdaw.chatwithnpc.conversation.ConversationHandler
Conversation of an NPC
 
The conversation will record the conversation of a NPC.
It is used to execute the conversation with OpenAI asynchronously.
- Version:
- 1.0
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionConversationHandler(@NotNull NPCEntity npc) Construct a new Conversation for an NPC.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddiscard()Discard the conversation.getNpc()Get the NPC that this conversation is handling.longGet the time when the conversation was last updated.Get the time when the conversation was last updated in a human-readable format.booleanGet the NPC's current conversation.voidreplyToEntity(String message) Reply to the NPC with a message.voidSend a wait message to the NPC.voidsetTalking(boolean isTalking) Set the NPC's current conversation.voidSay hello to the NPC.
- 
Field Details- 
npc
- 
isTalkingprotected boolean isTalking
- 
updateTimeprotected long updateTime
 
- 
- 
Constructor Details- 
ConversationHandlerConstruct a new Conversation for an NPC. This will start a conversation with the NPC asynchronously.- Parameters:
- npc- The NPC to start a conversation with.
 
 
- 
- 
Method Details- 
getNpcGet the NPC that this conversation is handling.- Returns:
- The NPC that this conversation is handling.
 
- 
sendWaitMessagepublic void sendWaitMessage()Send a wait message to the NPC. This will make the NPC reply to the player with a waiting message.
- 
startConversationpublic void startConversation()Say hello to the NPC. This will start a conversation with the NPC asynchronously.
- 
replyToEntityReply to the NPC with a message. Then the NPC will reply to the player something. This method is asynchronous.- Parameters:
- message- The message sent to the NPC.
 
- 
getUpdateTimepublic long getUpdateTime()Get the time when the conversation was last updated.- Returns:
- The time when the conversation was last updated.
 
- 
getUpdateTimeStringGet the time when the conversation was last updated in a human-readable format.- Returns:
- The time when the conversation was last updated in a human-readable format.
 
- 
isTalkingpublic boolean isTalking()Get the NPC's current conversation.- Returns:
- The NPC's current conversation.
 
- 
setTalkingpublic void setTalking(boolean isTalking) Set the NPC's current conversation.- Parameters:
- isTalking- The NPC's current conversation.
 
- 
discardpublic void discard()Discard the conversation. This will stop the conversation with the NPC. If the NPC is not needed to remember the conversation, all the messages in this conversation will be deleted.
 
-