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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
discard()
Discard the conversation.getNpc()
Get the NPC that this conversation is handling.long
Get the time when the conversation was last updated.Get the time when the conversation was last updated in a human-readable format.boolean
Get the NPC's current conversation.void
replyToEntity
(String message) Reply to the NPC with a message.void
setTalking
(boolean isTalking) Set the NPC's current conversation.
-
Field Details
-
npc
-
isTalking
protected boolean isTalking -
updateTime
protected long updateTime
-
-
Method Details
-
getNpc
Get the NPC that this conversation is handling.- Returns:
- The NPC that this conversation is handling.
-
replyToEntity
Reply 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.
-
getUpdateTime
public long getUpdateTime()Get the time when the conversation was last updated.- Returns:
- The time when the conversation was last updated.
-
getUpdateTimeString
Get 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.
-
isTalking
public boolean isTalking()Get the NPC's current conversation.- Returns:
- The NPC's current conversation.
-
setTalking
public void setTalking(boolean isTalking) Set the NPC's current conversation.- Parameters:
isTalking
- The NPC's current conversation.
-
discard
public 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.
-