Class EntityManager
-
Constructor Summary
ConstructorsConstructorDescriptionEntityManager(Graves plugin) Initializes the EntityManager with the specified plugin instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanOpenGrave(org.bukkit.entity.Player player, Grave grave) Checks if a player can open a specified grave.voidcreateArmorStand(org.bukkit.Location location, Grave grave) Creates an armor stand at a specified location associated with a grave.org.bukkit.inventory.ItemStackcreateGraveCompass(org.bukkit.entity.Player player, org.bukkit.Location location, Grave grave) Creates a grave compass for the specified player, location, and grave.voidcreateItemFrame(org.bukkit.Location location, Grave grave) Creates an item frame at a specified location associated with a grave.getCompassesFromInventory(org.bukkit.entity.HumanEntity player) Retrieves a map of compasses and their associated UUIDs from a player's inventory.getDataString(org.bukkit.entity.Entity entity, String key) Retrieves the persistent data string associated with the given key from the specified entity.getEntityName(org.bukkit.entity.Entity entity) Returns the name of the specified entity.Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> getEquipmentMap(org.bukkit.entity.LivingEntity livingEntity, Grave grave) Retrieves a map of equipment slots and their corresponding item stacks for a living entity and grave.getGraveFromEntityData(org.bukkit.entity.Entity entity) Retrieves aGraveobject from the persistent data or metadata of the specified entity.getGraveUUIDFromItemStack(org.bukkit.inventory.ItemStack itemStack) Retrieves the grave UUID from an item stack.booleanhasDataByte(org.bukkit.entity.Entity entity, String string) Checks if the specified entity has a persistent data byte with the given key.booleanhasDataString(org.bukkit.entity.Entity entity, String string) Checks if the specified entity has a persistent data string with the given key.voidplayPlayerSound(String string, org.bukkit.entity.Entity entity, Grave grave) Plays a player-specific sound at the entity's location.voidplayPlayerSound(String string, org.bukkit.entity.Entity entity, List<String> permissionList) Plays a player-specific sound at the entity's location with a permission list.voidplayPlayerSound(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Plays a player-specific sound at a specified location for an entity.voidplayPlayerSound(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, List<String> permissionList) Plays a player-specific sound at a specified location with a permission list.voidplayPlayerSound(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, List<String> permissionList, float volume, float pitch) Plays a player-specific sound at a specified location with additional parameters.voidplayWorldSound(String string, org.bukkit.entity.Player player) Plays a world sound at the player's location.voidplayWorldSound(String string, org.bukkit.entity.Player player, Grave grave) Plays a world sound at the player's location, associated with a grave.voidplayWorldSound(String string, org.bukkit.Location location, Grave grave) Plays a world sound at a specified location, associated with a grave.voidplayWorldSound(String string, org.bukkit.Location location, org.bukkit.entity.EntityType entityType, List<String> permissionList, float volume, float pitch) Plays a world sound at a specified location with additional parameters.voidremoveEntity(Grave grave) Removes all entities associated with a grave.voidremoveEntity(Map<EntityData, org.bukkit.entity.Entity> entityDataMap) Removes a map of entity data and their associated entities.voidrunCommands(String string, String name, org.bukkit.Location location, Grave grave) Runs commands associated with a name, location, and grave.voidrunCommands(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Runs commands associated with an entity, location, and grave.booleanrunFunction(org.bukkit.entity.Entity entity, String function) Runs a function associated with an entity and a specified function name.booleanrunFunction(org.bukkit.entity.Entity entity, String function, Grave grave) Runs a function associated with an entity, a specified function name, and a grave.voidsendMessage(String string, org.bukkit.command.CommandSender commandSender) Sends a message to a command sender.voidsendMessage(String string, org.bukkit.entity.Entity entity) Sends a message to an entity.voidsendMessage(String string, org.bukkit.entity.Entity entity, String name, org.bukkit.Location location, List<String> permissionList) Sends a message to an entity with a custom name and a permission list.voidsendMessage(String string, org.bukkit.entity.Entity entity, List<String> permissionList) Sends a message to an entity with a permission list.voidsendMessage(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Sends a message to an entity at a specified location associated with a grave.voidsendMessage(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, List<String> permissionList) Sends a message to an entity at a specified location with a permission list.voidsetDataByte(org.bukkit.entity.Entity entity, String key) Sets a persistent data byte for the specified entity with the given key.voidsetDataString(org.bukkit.entity.Entity entity, String key, String string) Sets a persistent data string for the specified entity with the given key.voidspawnZombie(org.bukkit.Location location, Grave grave) Spawns a zombie at a specified location, associated with a grave.voidspawnZombie(org.bukkit.Location location, org.bukkit.entity.Entity entity, org.bukkit.entity.LivingEntity targetEntity, Grave grave) Spawns a zombie at a specified location, targeting a specified entity, and associated with a grave.voidswingMainHand(org.bukkit.entity.Player player) Swings the main hand of the specified player.voidteleportEntity(org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Teleports an entity to a grave-related target location with safety checks, optional delay, movement-to-cancel behavior, and event hooks.Methods inherited from class com.ranull.graves.manager.EntityDataManager
createEntityData, createEntityData, getEntityData, getEntityDataMap, getGrave, getGrave, getLoadedEntityDataList, removeEntityData, removeEntityData
-
Constructor Details
-
EntityManager
Initializes the EntityManager with the specified plugin instance.- Parameters:
plugin- the Graves plugin instance.
-
-
Method Details
-
swingMainHand
public void swingMainHand(org.bukkit.entity.Player player) Swings the main hand of the specified player.- Parameters:
player- the player whose main hand to swing.
-
createGraveCompass
public org.bukkit.inventory.ItemStack createGraveCompass(org.bukkit.entity.Player player, org.bukkit.Location location, Grave grave) Creates a grave compass for the specified player, location, and grave.- Parameters:
player- the player for whom the compass is created.location- the location to set on the compass.grave- the grave associated with the compass.- Returns:
- the created compass item stack.
-
getCompassesFromInventory
public Map<org.bukkit.inventory.ItemStack,UUID> getCompassesFromInventory(org.bukkit.entity.HumanEntity player) Retrieves a map of compasses and their associated UUIDs from a player's inventory.- Parameters:
player- the player whose inventory to check.- Returns:
- a map of compasses and their associated UUIDs.
-
getGraveUUIDFromItemStack
Retrieves the grave UUID from an item stack.- Parameters:
itemStack- the item stack to check.- Returns:
- the grave UUID, or null if not found.
-
teleportEntity
public void teleportEntity(org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Teleports an entity to a grave-related target location with safety checks, optional delay, movement-to-cancel behavior, and event hooks.- Parameters:
entity- the entity to teleport (player or other)location- the base location to use for resolving a safe teleport positiongrave- the grave context (for yaw, messages, permissions, etc.)
-
playWorldSound
Plays a world sound at the player's location.- Parameters:
string- the sound identifier.player- the player whose location to play the sound at.
-
playWorldSound
Plays a world sound at the player's location, associated with a grave.- Parameters:
string- the sound identifier.player- the player whose location to play the sound at.grave- the grave associated with the sound.
-
playWorldSound
Plays a world sound at a specified location, associated with a grave.- Parameters:
string- the sound identifier.location- the location to play the sound at.grave- the grave associated with the sound.
-
playWorldSound
public void playWorldSound(String string, org.bukkit.Location location, org.bukkit.entity.EntityType entityType, List<String> permissionList, float volume, float pitch) Plays a world sound at a specified location with additional parameters.- Parameters:
string- the sound identifier.location- the location to play the sound at.entityType- the type of entity associated with the sound.permissionList- the list of permissions associated with the sound.volume- the volume of the sound.pitch- the pitch of the sound.
-
playPlayerSound
Plays a player-specific sound at the entity's location.- Parameters:
string- the sound identifier.entity- the entity to play the sound for.grave- the grave associated with the sound.
-
playPlayerSound
public void playPlayerSound(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Plays a player-specific sound at a specified location for an entity.- Parameters:
string- the sound identifier.entity- the entity to play the sound for.location- the location to play the sound at.grave- the grave associated with the sound.
-
playPlayerSound
public void playPlayerSound(String string, org.bukkit.entity.Entity entity, List<String> permissionList) Plays a player-specific sound at the entity's location with a permission list.- Parameters:
string- the sound identifier.entity- the entity to play the sound for.permissionList- the list of permissions associated with the sound.
-
playPlayerSound
public void playPlayerSound(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, List<String> permissionList) Plays a player-specific sound at a specified location with a permission list.- Parameters:
string- the sound identifier.entity- the entity to play the sound for.location- the location to play the sound at.permissionList- the list of permissions associated with the sound.
-
playPlayerSound
public void playPlayerSound(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, List<String> permissionList, float volume, float pitch) Plays a player-specific sound at a specified location with additional parameters.- Parameters:
string- the sound identifier.entity- the entity to play the sound for.location- the location to play the sound at.permissionList- the list of permissions associated with the sound.volume- the volume of the sound.pitch- the pitch of the sound.
-
sendMessage
Sends a message to a command sender.- Parameters:
string- the message identifier.commandSender- the command sender to send the message to.
-
sendMessage
Sends a message to an entity.- Parameters:
string- the message identifier.entity- the entity to send the message to.
-
sendMessage
public void sendMessage(String string, org.bukkit.entity.Entity entity, List<String> permissionList) Sends a message to an entity with a permission list.- Parameters:
string- the message identifier.entity- the entity to send the message to.permissionList- the list of permissions associated with the message.
-
sendMessage
public void sendMessage(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, List<String> permissionList) Sends a message to an entity at a specified location with a permission list.- Parameters:
string- the message identifier.entity- the entity to send the message to.location- the location associated with the message.permissionList- the list of permissions associated with the message.
-
sendMessage
public void sendMessage(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Sends a message to an entity at a specified location associated with a grave.- Parameters:
string- the message identifier.entity- the entity to send the message to.location- the location associated with the message.grave- the grave associated with the message.
-
sendMessage
public void sendMessage(String string, org.bukkit.entity.Entity entity, String name, org.bukkit.Location location, List<String> permissionList) Sends a message to an entity with a custom name and a permission list.- Parameters:
string- the message identifier.entity- the entity to send the message to.name- the custom name associated with the message.location- the location associated with the message.permissionList- the list of permissions associated with the message.
-
runCommands
public void runCommands(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave) Runs commands associated with an entity, location, and grave.- Parameters:
string- the command identifier.entity- the entity associated with the command.location- the location associated with the command.grave- the grave associated with the command.
-
runCommands
Runs commands associated with a name, location, and grave.- Parameters:
string- the command identifier.name- the name associated with the command.location- the location associated with the command.grave- the grave associated with the command.
-
runFunction
Runs a function associated with an entity and a specified function name.- Parameters:
entity- the entity to run the function for.function- the name of the function to run.- Returns:
- true if the function was run successfully, false otherwise.
-
runFunction
Runs a function associated with an entity, a specified function name, and a grave.- Parameters:
entity- the entity to run the function for.function- the name of the function to run.grave- the grave associated with the function.- Returns:
- true if the function was run successfully, false otherwise.
-
canOpenGrave
Checks if a player can open a specified grave. Supports both Java and Bedrock players (via Geyser/Floodgate).- Parameters:
player- the player attempting to open the gravegrave- the grave to check- Returns:
- true if the player can open the grave, false otherwise
-
spawnZombie
public void spawnZombie(org.bukkit.Location location, org.bukkit.entity.Entity entity, org.bukkit.entity.LivingEntity targetEntity, Grave grave) Spawns a zombie at a specified location, targeting a specified entity, and associated with a grave.- Parameters:
location- the location to spawn the zombie.entity- the entity associated with the zombie spawn.targetEntity- the entity to be targeted by the zombie.grave- the grave associated with the zombie spawn.
-
spawnZombie
Spawns a zombie at a specified location, associated with a grave.- Parameters:
location- the location to spawn the zombie.grave- the grave associated with the zombie spawn.
-
createArmorStand
Creates an armor stand at a specified location associated with a grave.- Parameters:
location- the location to create the armor stand.grave- the grave associated with the armor stand.
-
createItemFrame
Creates an item frame at a specified location associated with a grave.- Parameters:
location- the location to create the item frame.grave- the grave associated with the item frame.
-
removeEntity
Removes all entities associated with a grave.- Parameters:
grave- the grave whose entities to remove.
-
removeEntity
Removes a map of entity data and their associated entities.- Parameters:
entityDataMap- the map of entity data and entities to remove.
-
getEquipmentMap
public Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack> getEquipmentMap(org.bukkit.entity.LivingEntity livingEntity, Grave grave) Retrieves a map of equipment slots and their corresponding item stacks for a living entity and grave.- Parameters:
livingEntity- the living entity to retrieve the equipment for.grave- the grave associated with the equipment.- Returns:
- a map of equipment slots and their corresponding item stacks.
-
getEntityName
Returns the name of the specified entity.This method handles different types of entities, including players and other entities, with legacy support for older versions of Minecraft.
- Parameters:
entity- theEntitywhose name is to be retrieved- Returns:
- the name of the entity, or "null" if the entity is null
-
hasDataString
Checks if the specified entity has a persistent data string with the given key.The method checks for persistent data if supported; otherwise, it checks for metadata.
- Parameters:
entity- theEntityto checkstring- the key of the persistent data or metadata- Returns:
trueif the entity has the specified data string;falseotherwise
-
hasDataByte
Checks if the specified entity has a persistent data byte with the given key.The method checks for persistent data if supported; otherwise, it checks for metadata.
- Parameters:
entity- theEntityto checkstring- the key of the persistent data or metadata- Returns:
trueif the entity has the specified data byte;falseotherwise
-
getDataString
Retrieves the persistent data string associated with the given key from the specified entity.If persistent data is supported, it retrieves the string from the persistent data container; otherwise, it retrieves it from metadata.
- Parameters:
entity- theEntityto retrieve data fromkey- the key of the persistent data or metadata- Returns:
- the data string associated with the key, or
nullif not found
-
setDataString
Sets a persistent data string for the specified entity with the given key.If persistent data is supported, it sets the string in the persistent data container; otherwise, it sets it in metadata.
- Parameters:
entity- theEntityto set data forkey- the key of the persistent data or metadatastring- the data string to set
-
setDataByte
Sets a persistent data byte for the specified entity with the given key.If persistent data is supported, it sets the byte in the persistent data container; otherwise, it sets it in metadata.
- Parameters:
entity- theEntityto set data forkey- the key of the persistent data or metadata
-
getGraveFromEntityData
Retrieves aGraveobject from the persistent data or metadata of the specified entity.The method checks if persistent data is supported and looks for a "graveUUID" key. If not found, it checks for metadata.
- Parameters:
entity- theEntityfrom which to retrieve the grave- Returns:
- the
Graveassociated with the entity, ornullif not found
-