Package com.ranull.graves.integration
Class CitizensNPC
java.lang.Object
com.ranull.graves.manager.EntityDataManager
com.ranull.graves.integration.CitizensNPC
Manages NPC interactions and corpse creation/removal related to player graves using Citizens2.
Utilizes reflection to remain compatible across multiple Citizens versions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CitizensNPCInteractListenerprivate final Methodprivate final Methodprivate final Methodprivate final Methodprivate final Methodprivate final Methodprivate final Methodprivate final Class<?> private final Gravesprivate final Class<?> private final Method -
Constructor Summary
ConstructorsConstructorDescriptionCitizensNPC(Graves plugin) Constructs a new CitizensNPC instance with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateCorpse(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.voidcreateCorpse(org.bukkit.Location location, Grave grave) Creates a new NPC corpse at the specified location with the given grave data.voidCreates NPC corpses based on the cached entity data.private Class<?> findClass(String[] names, ClassLoader loader) private Map<EntityData, Object> getEntityDataNPCMap(List<EntityData> list) Finds all matching EntityData and NPCs.private ObjectgetNPCByName(String name) Locates an NPC by name via registry iteration.booleangetNPCCorpse(Grave grave) Checks if a corpse exists for the grave.private StringgetNPCNameFromLocation(org.bukkit.Location location) voidRegisters the NPC interaction listeners.voidremoveCorpse(EntityData entityData) Removes a specific corpse entity and its data.voidremoveCorpse(Grave grave) Removes the NPC corpse for the given grave.voidremoveCorpse(Map<EntityData, Object> entityDataMap) Bulk removal using reflection.voidMethods inherited from class com.ranull.graves.manager.EntityDataManager
createEntityData, createEntityData, getEntityData, getEntityDataMap, getGrave, getGrave, getLoadedEntityDataList, removeEntityData, removeEntityData
-
Field Details
-
plugin
-
citizensNPCInteractListener
-
npcClass
-
skinTraitClass
-
getNPCRegistryMethod
-
createNPCMethod
-
spawnMethod
-
dataMethod
-
getOrAddTraitMethod
-
destroyMethod
-
deregisterMethod
-
nmsRemoveMethod
-
-
Constructor Details
-
CitizensNPC
Constructs a new CitizensNPC instance with the specified Graves plugin.- Parameters:
plugin- The main Graves plugin instance.
-
-
Method Details
-
findClass
-
registerListeners
public void registerListeners()Registers the NPC interaction listeners. -
unregisterListeners
public void unregisterListeners() -
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 for the given grave. -
removeCorpse
Removes a specific corpse entity and its data. -
removeCorpse
Bulk removal using reflection. -
getNPCNameFromLocation
-
getEntityDataNPCMap
Finds all matching EntityData and NPCs. -
getNPCByName
Locates an NPC by name via registry iteration. -
getNPCCorpse
Checks if a corpse exists for the grave.
-