Class ConversationManager
java.lang.Object
com.jackdaw.chatwithnpc.conversation.ConversationManager
This class is used to manage conversations between players and NPCs.
- It is used to start, end, and get conversations.
- It also checks if a player is near a conversation.
- Every NPC has a unique conversation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidEnd all conversationsstatic voidendConversation(UUID uuid) End a conversation with a specific UUID.static voidEnd all conversations that are out of timestatic ConversationHandlergetConversation(UUID uuid) Get the conversation with a specific UUIDstatic @Nullable ConversationHandlergetConversation(net.minecraft.entity.player.PlayerEntity player) Get the closest conversation around a playerstatic List<ConversationHandler>getConversations(net.minecraft.entity.player.PlayerEntity player) Get all conversations within a certain range of a playerstatic booleanisConversationNearby(net.minecraft.entity.player.PlayerEntity player) Check if there is a Conversation nearbystatic booleanisConversing(@NotNull UUID npcUUID) Check if an NPC is in a conversationstatic voidstartConversation(@NotNull NPCEntity npc) Start a conversation for an NPC
-
Field Details
-
conversationMap
-
-
Constructor Details
-
ConversationManager
public ConversationManager()
-
-
Method Details
-
startConversation
Start a conversation for an NPC- Parameters:
npc- The Entity to start a conversation with
-
isConversing
Check if an NPC is in a conversation- Parameters:
npcUUID- The NPC to check- Returns:
- True if the NPC is chatting, false otherwise
-
getConversation
Get the conversation with a specific UUID- Parameters:
uuid- The UUID of the conversation- Returns:
- The conversation with the UUID
-
getConversation
@Nullable public static @Nullable ConversationHandler getConversation(net.minecraft.entity.player.PlayerEntity player) Get the closest conversation around a player- Parameters:
player- The player to check- Returns:
- The closest conversation to the player
-
isConversationNearby
public static boolean isConversationNearby(net.minecraft.entity.player.PlayerEntity player) Check if there is a Conversation nearby- Parameters:
player- The player to check- Returns:
- True if there is a Conversation nearby, false otherwise
-
getConversations
public static List<ConversationHandler> getConversations(net.minecraft.entity.player.PlayerEntity player) Get all conversations within a certain range of a player- Parameters:
player- The player to check- Returns:
- A list of Conversations within the range of the player
-
endConversation
End a conversation with a specific UUID. This will also remove the NPCEntity the UUID represented from NPCEntityManager.- Parameters:
uuid- The UUID of the conversation
-
endOutOfTimeConversations
public static void endOutOfTimeConversations()End all conversations that are out of time -
endAllConversations
public static void endAllConversations()End all conversations
-