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
FieldsModifier and TypeFieldDescriptionstatic final ConcurrentHashMap<UUID,
ConversationHandler> static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
End all conversationsstatic void
endConversation
(UUID uuid) End a conversation with a specific UUID.static void
End all conversations that are out of timestatic ConversationHandler
getConversation
(UUID uuid) Get the conversation with a specific UUIDstatic @Nullable ConversationHandler
getConversation
(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 List<net.minecraft.entity.Entity>
getEntitiesInRange
(@NotNull net.minecraft.entity.Entity theEntity, double range) static boolean
isConversationNearby
(net.minecraft.entity.player.PlayerEntity player) Check if there is a Conversation nearbystatic boolean
isConversing
(@NotNull UUID npcUUID) Check if an NPC is in a conversationstatic void
startConversation
(@NotNull NPCEntity npc) Start a conversation for an NPC
-
Field Details
-
conversationMap
-
outOfTime
public static final long outOfTime- See Also:
-
-
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
-
getEntitiesInRange
public static List<net.minecraft.entity.Entity> getEntitiesInRange(@NotNull @NotNull net.minecraft.entity.Entity theEntity, double range) -
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
-