Package com.ranull.graves.integration
Class PlayerNPC
java.lang.Object
com.ranull.graves.manager.EntityDataManager
com.ranull.graves.integration.PlayerNPC
Manages NPC interactions and corpse creation related to player graves using NPCLib.
Extends EntityDataManager to handle entity data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NPCInteractListener
private final dev.sergiferry.playernpc.api.NPCLib
private final Graves
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createCorpse
(UUID uuid, org.bukkit.Location location, Grave grave, boolean createEntityData) Creates a new NPC corpse with a specific UUID at the given location using the provided grave data.void
createCorpse
(org.bukkit.Location location, Grave grave) Creates a new NPC corpse at the specified location with the given grave data.void
Creates NPC corpses based on the cached entity data.private Map
<EntityData, dev.sergiferry.playernpc.api.NPC.Global> getEntityDataNPCMap
(List<EntityData> entityDataList) Retrieves a map of entity data to NPC.Global instances based on the provided entity data list.void
Registers the NPC interaction listeners.void
removeCorpse
(EntityData entityData) Removes the NPC corpse associated with the given entity data.void
removeCorpse
(Grave grave) Removes the NPC corpse associated with the given grave.void
removeCorpse
(Map<EntityData, dev.sergiferry.playernpc.api.NPC.Global> entityDataMap) Removes multiple NPC corpses based on the provided entity data map.void
Unregisters the NPC interaction listeners.Methods inherited from class com.ranull.graves.manager.EntityDataManager
createEntityData, createEntityData, getEntityData, getEntityDataMap, getGrave, getGrave, getLoadedEntityDataList, removeEntityData, removeEntityData
-
Field Details
-
plugin
-
npcLib
private final dev.sergiferry.playernpc.api.NPCLib npcLib -
npcInteractListener
-
-
Constructor Details
-
PlayerNPC
Constructs a new PlayerNPC instance with the specified Graves plugin.- Parameters:
plugin
- The main Graves plugin instance.
-
-
Method Details
-
registerListeners
public void registerListeners()Registers the NPC interaction listeners. -
unregisterListeners
public void unregisterListeners()Unregisters the NPC interaction listeners. -
createCorpses
public void createCorpses()Creates NPC corpses based on the cached entity data. -
createCorpse
Creates a new NPC corpse at the specified location with the given grave data.- Parameters:
location
- The location to spawn the NPC.grave
- The grave data for the NPC.
-
createCorpse
public void createCorpse(UUID uuid, org.bukkit.Location location, Grave grave, boolean createEntityData) Creates a new NPC corpse with a specific UUID at the given location using the provided grave data.- Parameters:
uuid
- The UUID for the NPC.location
- The location to spawn the NPC.grave
- The grave data for the NPC.createEntityData
- Whether to create entity data for the NPC.
-
removeCorpse
Removes the NPC corpse associated with the given grave.- Parameters:
grave
- The grave whose associated NPC corpse should be removed.
-
removeCorpse
Removes the NPC corpse associated with the given entity data.- Parameters:
entityData
- The entity data whose associated NPC corpse should be removed.
-
removeCorpse
Removes multiple NPC corpses based on the provided entity data map.- Parameters:
entityDataMap
- A map of entity data to NPC.Global instances to be removed.
-
getEntityDataNPCMap
private Map<EntityData,dev.sergiferry.playernpc.api.NPC.Global> getEntityDataNPCMap(List<EntityData> entityDataList) Retrieves a map of entity data to NPC.Global instances based on the provided entity data list.- Parameters:
entityDataList
- The list of entity data to match with NPC.Global instances.- Returns:
- A map of entity data to NPC.Global instances.
-