Class ConversationManager

java.lang.Object
com.jackdaw.chatwithnpc.conversation.ConversationManager

public class ConversationManager extends Object
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 Details

  • Constructor Details

    • ConversationManager

      public ConversationManager()
  • Method Details

    • startConversation

      public static void startConversation(@NotNull @NotNull NPCEntity npc)
      Start a conversation for an NPC
      Parameters:
      npc - The Entity to start a conversation with
    • isConversing

      public static boolean isConversing(@NotNull @NotNull UUID npcUUID)
      Check if an NPC is in a conversation
      Parameters:
      npcUUID - The NPC to check
      Returns:
      True if the NPC is chatting, false otherwise
    • getConversation

      public static ConversationHandler getConversation(UUID uuid)
      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

      public static void endConversation(UUID uuid)
      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