Class GravesXAPI
Graves are created with various configurations, including equipment, items, experience, protection, and more. The API also handles event triggering when graves are created and ensures data is stored correctly.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGravesXAPI(Graves plugin) Constructor for initializing the GravesXAPI with the main plugin instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidabandonGrave(@NotNull Grave grave) Marks the specified grave as abandoned, preventing further interaction.voidautoLootGrave(@NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.Location location, @NotNull Grave grave) Automatically loots the specified grave for the given entity at the given location.voidbreakGrave(@NotNull Grave grave) Breaks the specified grave, triggering its removal and handling any related events.voidbreakGrave(@NotNull org.bukkit.Location location, @NotNull Grave grave) Breaks the specified grave at a given location.org.bukkit.LocationchunkStringToLocation(@NotNull String string) Converts a chunk string representation back to a Location object.chunkToString(@NotNull org.bukkit.Location location) Converts a chunk's location to a string representation.voidDeprecated.This method is deprecated and will be removed in a future version.voidcopyResources(@NotNull String inputPath, @NotNull String outputPath) Copies resources from the plugin's JAR file to the specified output path.voidcopyResources(@NotNull String inputPath, @NotNull String outputPath, boolean overwrite) Copies resources from the plugin's JAR file to the specified output path, with an option to overwrite existing files.org.bukkit.Particle.DustOptionscreateDustOptionsFromHex(@NotNull String hexColor, float size) Creates a Particle.DustOptions object using a hex color code.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.Entity killer, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining) Creates a grave for an entity killed by another entity.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.Entity killer, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity killed by another entity with protection settings.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.Entity killer, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause, boolean graveProtection, long graveProtectionTime) Main method to create a grave with all available parameters.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, int experience, long timeAliveRemaining) Creates a grave for an entity with the basic parameters.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, long timeAliveRemaining) Creates a grave for an entity with the basic parameters.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining) Creates a grave for an entity with the basic parameters.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, boolean graveProtection, long graveProtectionTime) Creates a grave with additional protection settings.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause) Creates a grave for an entity with a specific storage type.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity with a specific storage type and additional protection settings.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @NotNull Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @NotNull List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining) Creates a grave for an entity at a specific location without a killer and no storage type.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @NotNull Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @NotNull List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity at a specific location with protection settings.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity at a specific location with grave protection, no killer, and no storage type.voidcreateGrave(@NotNull org.bukkit.entity.Entity victim, @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable org.bukkit.Location locationDeath, @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause) Creates a grave for an entity at a specific location where the victim died.decodeBase64ToObject(@NotNull String base64String) Decodes a Base64 string to an object using Base64Util.static voiddownloadAndReplacePlugin(long pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.static voiddownloadAndReplacePlugin(String pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.voiddropGraveItems(@NotNull org.bukkit.Location location, @NotNull Grave grave) Drops the items stored in the specified grave at the given location.encodeObjectToBase64(@NotNull Object object) Encodes an object to a Base64 string using Base64Util.voidequipArmor(@NotNull org.bukkit.inventory.Inventory inventory, @NotNull org.bukkit.entity.Player player) Equips the player's armor from the given inventory.voidequipItems(@NotNull org.bukkit.inventory.Inventory inventory, @NotNull org.bukkit.entity.Player player) Equips the player's inventory items from the given inventory.getBlockData(@NotNull org.bukkit.Location location, @NotNull UUID graveUUID, @NotNull String replaceMaterial, @NotNull String replaceData) Retrieves the BlockData associated with a grave at a given location.getChunkData(@NotNull org.bukkit.Location location) Retrieves the ChunkData for the chunk containing the specified location.org.bukkit.LocationgetClosestLocation(@NotNull org.bukkit.Location locationBase, @NotNull List<org.bukkit.Location> locationList) Finds the closest location to a given base location from a list of locations.org.bukkit.ColorGets the Color corresponding to the given color name using ColorUtil.org.bukkit.ColorgetColorFromHex(@NotNull String hex) Parses a hex color code to a Color using ColorUtil.intgetDropPercent(int experience, float percent) Calculates the drop percentage of experience using ExperienceUtil.getEntityData(@NotNull org.bukkit.Location location, @NotNull UUID uuidEntity, @NotNull UUID uuidGrave, EntityData.Type type) Retrieves the EntityData for an entity associated with a grave.intgetExperienceAtLevel(int level) Gets the experience required to reach a specific level using ExperienceUtil.Gets the grave typelongReturns the total number of graves for all players.longgetGraveAmount(@Nullable org.bukkit.entity.Player targetPlayer) Returns the number of graves associated with a specified player.Retrieves the instance of theGravesclass.doublegetHighestDouble(@NotNull org.bukkit.entity.Player player, String permission) Gets the highest double value associated with a specific permission prefix for the player.intgetHighestInt(@NotNull org.bukkit.entity.Player player, @Nullable String permission) Gets the highest integer value associated with a specific permission prefix for the player.getHologramData(@NotNull org.bukkit.Location location, @NotNull UUID uuidEntity, @NotNull UUID uuidGrave, int line) Retrieves the HologramData for a hologram associated with a grave.Gets the instance of the GravesXAPI.intgetInventorySize(int size) Gets the appropriate inventory size based on the given size.getLatestVersion(int resourceId) Gets the latest version of a resource from SpigotMC.longgetLevelFromExperience(long experience) Calculates the level from a given amount of experience using ExperienceUtil.getLocationData(@NotNull org.bukkit.Location location) Retrieves the LocationData for a given location.intgetPlayerDropExperience(@NotNull org.bukkit.entity.Player player, float expStorePercent) Deprecated.This method is deprecated and will be removed in a future version.intgetPlayerExperience(@NotNull org.bukkit.entity.Player player) Gets the total experience of the specified player using ExperienceUtil.com.mojang.authlib.GameProfilegetPlayerGameProfile(@NotNull org.bukkit.entity.Player player) Retrieves the GameProfile of the specified player.private List<org.bukkit.inventory.ItemStack> getRemovedItemStacks(@NotNull org.bukkit.entity.LivingEntity livingEntity) Retrieves the list of removed item stacks for the specified entity.org.bukkit.RotationgetRotationFromBlockFace(@NotNull org.bukkit.block.BlockFace face) Retrieves the Rotation corresponding to a given BlockFace.getSkinSignature(@NotNull org.bukkit.entity.Entity entity) Gets the skin signature of the specified entity if it is a player.getTexture(@NotNull org.bukkit.entity.Entity entity) Retrieves the texture of the specified entity.Converts a string to a UUID.booleanhasPermission(@NotNull org.bukkit.entity.Entity entity, @NotNull String permission) Checks if the specified entity has the given permission using EntityUtil.inventoryToString(@NotNull org.bukkit.inventory.Inventory inventory) Converts the given inventory to a string representation.booleanisAir(@NotNull org.bukkit.Material material) Checks if the given material is an air block.booleanDeprecated.UseisGrave(Grave, Location)instead for precise location checking.booleanChecks if a given location matches the death location of a specific grave.booleanisLava(@NotNull org.bukkit.Material material) Checks if the given material is lava.booleanisNearGrave(@NotNull org.bukkit.Location location) Determines if the specified location is near a grave.booleanisNearGrave(@NotNull org.bukkit.Location location, @NotNull org.bukkit.block.Block block) Determines if the specified location is near a grave, considering a specific block.booleanisNearGrave(@NotNull org.bukkit.Location location, @NotNull org.bukkit.entity.Player player) Determines if the specified location is near a grave, considering a specific player.booleanisNearGrave(@NotNull org.bukkit.Location location, @Nullable org.bukkit.entity.Player player, @Nullable org.bukkit.block.Block block) Determines if the specified location is near a grave.booleanisPlayerHead(@NotNull String material) Checks if the given material is a player head.booleanisPlayerHead(@NotNull org.bukkit.Material material) Checks if the given material is a player head.booleanisSafeNotSolid(@NotNull org.bukkit.Material material) Checks if the given material is not solid and is safe (i.e., not lava).booleanisSafeSolid(@NotNull org.bukkit.Material material) Checks if the given material is solid and safe (i.e., not lava).booleanisValidYAML(@NotNull File file) Checks if a given file is a valid YAML file.booleanisWater(@NotNull org.bukkit.Material material) Checks if the given material is water.voidLoads a class with the specified name using ClassUtil.locationToString(@NotNull org.bukkit.Location location) Converts a Location object to a string representation.voidMoves a file to a new location with a new name using FileUtil.private voidplaceGraveBlocks(@NotNull Grave grave, @NotNull Map<org.bukkit.Location, BlockData.BlockType> locationMap, @NotNull org.bukkit.entity.LivingEntity livingEntity) Posts the given log content to mclo.gs and returns the URL of the posted log.voidregister()Registers the API as an event listener in the plugin manager.voidremoveGrave(@NotNull Grave grave) Removes the specified grave from the grave manager.voidremoveOldestGrave(@NotNull org.bukkit.entity.LivingEntity livingEntity) Removes the oldest grave associated with the specified living entity.org.bukkit.LocationroundLocation(@NotNull org.bukkit.Location location) Rounds the given location's coordinates to the nearest whole numbers.voidsetSkullTexture(@NotNull org.bukkit.block.Skull skull, @NotNull String name, @NotNull String base64) Sets the texture of a Skull block.voidsetSkullTexture(@NotNull org.bukkit.inventory.meta.SkullMeta skullMeta, @NotNull String name, @NotNull String base64) Sets the texture of a Skull item stack.org.bukkit.block.BlockFacesimplifyBlockFace(@NotNull org.bukkit.block.BlockFace face) Simplifies a given BlockFace to one of the four cardinal directions (NORTH, EAST, SOUTH, WEST).org.bukkit.inventory.InventorystringToInventory(@NotNull org.bukkit.inventory.InventoryHolder inventoryHolder, @NotNull String string, @NotNull String title) Converts a string representation of an inventory to an Inventory object.org.bukkit.LocationstringToLocation(@NotNull String string) Converts a string representation of a location back to a Location object.voidswingMainHand(@NotNull org.bukkit.entity.Player player) Triggers the main hand swing animation for the specified player.
-
Field Details
-
instance
-
plugin
-
-
Constructor Details
-
GravesXAPI
Constructor for initializing the GravesXAPI with the main plugin instance.- Parameters:
plugin- The main Graves plugin instance.
-
-
Method Details
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, long timeAliveRemaining) Creates a grave for an entity with the basic parameters.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.timeAliveRemaining- The remaining time the grave will stay alive.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, int experience, long timeAliveRemaining) Creates a grave for an entity with the basic parameters.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining) Creates a grave for an entity with the basic parameters.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, boolean graveProtection, long graveProtectionTime) Creates a grave with additional protection settings.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.graveProtection- Whether the grave is protected.graveProtectionTime- The time for which the grave remains protected.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, @Nullable org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause) Creates a grave for an entity with a specific storage type.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.damageCause- Damage Caused (nullable).
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, @Nullable org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity with a specific storage type and additional protection settings.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.damageCause- Damage Caused (nullable).graveProtection- Whether the grave is protected.graveProtectionTime- The time for which the grave remains protected.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, @Nullable org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause) Creates a grave for an entity at a specific location where the victim died.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @NotNull @NotNull Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @NotNull @NotNull List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, @Nullable org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity at a specific location with protection settings.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.graveProtection- Whether the grave is protected.graveProtectionTime- The time for which the grave remains protected.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @NotNull @NotNull Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @NotNull @NotNull List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining) Creates a grave for an entity at a specific location without a killer and no storage type.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity at a specific location with grave protection, no killer, and no storage type.- Parameters:
victim- The entity that died.killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.graveProtection- Whether the grave is protected.graveProtectionTime- The time for which the grave remains protected.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.Entity killer, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining) Creates a grave for an entity killed by another entity.- Parameters:
victim- The entity that died.killer- The entity that killed the victim (nullable).killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.Entity killer, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, boolean graveProtection, long graveProtectionTime) Creates a grave for an entity killed by another entity with protection settings.- Parameters:
victim- The entity that died.killer- The entity that killed the victim (nullable).killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.graveProtection- Whether the grave is protected.graveProtectionTime- The time for which the grave remains protected.
-
createGrave
public void createGrave(@NotNull @NotNull org.bukkit.entity.Entity victim, @Nullable @Nullable org.bukkit.entity.Entity killer, @Nullable @Nullable org.bukkit.entity.EntityType killerEntityType, @Nullable @Nullable org.bukkit.Location locationDeath, @Nullable @Nullable Map<org.bukkit.inventory.EquipmentSlot, org.bukkit.inventory.ItemStack> equipmentMap, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> itemStackList, int experience, long timeAliveRemaining, @Nullable org.bukkit.event.entity.EntityDamageEvent.DamageCause damageCause, boolean graveProtection, long graveProtectionTime) Main method to create a grave with all available parameters.- Parameters:
victim- The entity that died.killer- The entity that killed the victim (nullable).killerEntityType- The entity type of the killer.locationDeath- The location where the victim died (nullable).equipmentMap- The equipment the victim had at the time of death.itemStackList- The list of items the victim had at the time of death.experience- The experience the victim had.timeAliveRemaining- The remaining time the grave will stay alive.damageCause- Damage Caused (nullable).graveProtection- Whether the grave is protected.graveProtectionTime- The time for which the grave remains protected.
-
getRemovedItemStacks
private List<org.bukkit.inventory.ItemStack> getRemovedItemStacks(@NotNull @NotNull org.bukkit.entity.LivingEntity livingEntity) Retrieves the list of removed item stacks for the specified entity.- Parameters:
livingEntity- The entity whose removed item stacks are to be retrieved.- Returns:
- The list of removed item stacks.
-
placeGraveBlocks
private void placeGraveBlocks(@NotNull @NotNull Grave grave, @NotNull @NotNull Map<org.bukkit.Location, BlockData.BlockType> locationMap, @NotNull @NotNull org.bukkit.entity.LivingEntity livingEntity) -
removeGrave
Removes the specified grave from the grave manager.- Parameters:
grave- the grave to be removed
-
breakGrave
Breaks the specified grave, triggering its removal and handling any related events.- Parameters:
grave- the grave to be broken
-
breakGrave
public void breakGrave(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull Grave grave) Breaks the specified grave at a given location.- Parameters:
location- the location where the grave is locatedgrave- the grave to be broken
-
autoLootGrave
public void autoLootGrave(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull Grave grave) Automatically loots the specified grave for the given entity at the given location.- Parameters:
entity- the entity that will loot the gravelocation- the location of the gravegrave- the grave to be looted
-
abandonGrave
Marks the specified grave as abandoned, preventing further interaction.- Parameters:
grave- the grave to be abandoned
-
dropGraveItems
public void dropGraveItems(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull Grave grave) Drops the items stored in the specified grave at the given location.- Parameters:
location- the location where the items will be droppedgrave- the grave whose items are to be dropped
-
removeOldestGrave
public void removeOldestGrave(@NotNull @NotNull org.bukkit.entity.LivingEntity livingEntity) Removes the oldest grave associated with the specified living entity.- Parameters:
livingEntity- the entity whose oldest grave will be removed
-
isNearGrave
public boolean isNearGrave(@NotNull @NotNull org.bukkit.Location location, @Nullable @Nullable org.bukkit.entity.Player player, @Nullable @Nullable org.bukkit.block.Block block) Determines if the specified location is near a grave.This method serves as an overload to allow optional parameters such as a player or a block to be included in the proximity check.
- Parameters:
location- the location to check for nearby graves (required).player- the player to consider in the proximity check (optional; nullable).block- the block to consider in the proximity check (optional; nullable).- Returns:
trueif the location is near a grave, otherwisefalse.
-
isNearGrave
public boolean isNearGrave(@NotNull @NotNull org.bukkit.Location location) Determines if the specified location is near a grave.This variant of the method omits the player and block parameters.
- Parameters:
location- the location to check for nearby graves (required).- Returns:
trueif the location is near a grave, otherwisefalse.
-
isNearGrave
public boolean isNearGrave(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull org.bukkit.entity.Player player) Determines if the specified location is near a grave, considering a specific player.This variant of the method includes the player parameter but omits the block parameter.
- Parameters:
location- the location to check for nearby graves (required).player- the player to consider in the proximity check (required).- Returns:
trueif the location is near a grave, otherwisefalse.
-
isNearGrave
public boolean isNearGrave(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull org.bukkit.block.Block block) Determines if the specified location is near a grave, considering a specific block.This variant of the method includes the block parameter but omits the player parameter.
- Parameters:
location- the location to check for nearby graves (required).block- the block to consider in the proximity check (required).- Returns:
trueif the location is near a grave, otherwisefalse.
-
getGrave
Gets the grave type- Parameters:
uuid- the uuid of the grave
-
getBlockData
public BlockData getBlockData(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull UUID graveUUID, @NotNull @NotNull String replaceMaterial, @NotNull @NotNull String replaceData) Retrieves the BlockData associated with a grave at a given location.- Parameters:
location- The location of the grave.graveUUID- The unique identifier of the grave.replaceMaterial- The material to replace in the BlockData.replaceData- Additional data to apply to the BlockData.- Returns:
- A BlockData instance representing the grave at the specified location.
-
getChunkData
Retrieves the ChunkData for the chunk containing the specified location.- Parameters:
location- The location for which to retrieve the chunk data.- Returns:
- A ChunkData instance representing the chunk at the specified location.
-
getEntityData
public EntityData getEntityData(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull UUID uuidEntity, @NotNull @NotNull UUID uuidGrave, @NotNull EntityData.Type type) Retrieves the EntityData for an entity associated with a grave.- Parameters:
location- The location of the entity.uuidEntity- The unique identifier of the entity.uuidGrave- The unique identifier of the grave.type- The type of the entity.- Returns:
- An EntityData instance representing the entity associated with the grave.
-
getHologramData
public HologramData getHologramData(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull UUID uuidEntity, @NotNull @NotNull UUID uuidGrave, int line) Retrieves the HologramData for a hologram associated with a grave.- Parameters:
location- The location of the hologram.uuidEntity- The unique identifier of the entity associated with the hologram.uuidGrave- The unique identifier of the grave.line- The line number of the hologram to retrieve.- Returns:
- A HologramData instance representing the hologram associated with the grave.
-
getLocationData
Retrieves the LocationData for a given location.- Parameters:
location- The location for which to retrieve data.- Returns:
- A LocationData instance representing the specified location.
-
simplifyBlockFace
public org.bukkit.block.BlockFace simplifyBlockFace(@NotNull @NotNull org.bukkit.block.BlockFace face) Simplifies a given BlockFace to one of the four cardinal directions (NORTH, EAST, SOUTH, WEST).- Parameters:
face- The BlockFace to simplify.- Returns:
- The simplified BlockFace.
-
getRotationFromBlockFace
public org.bukkit.Rotation getRotationFromBlockFace(@NotNull @NotNull org.bukkit.block.BlockFace face) Retrieves the Rotation corresponding to a given BlockFace.- Parameters:
face- The BlockFace for which to retrieve the rotation.- Returns:
- The corresponding Rotation for the specified BlockFace.
-
encodeObjectToBase64
Encodes an object to a Base64 string using Base64Util.- Parameters:
object- The object to encode.- Returns:
- The Base64 encoded string, or null if encoding fails.
-
decodeBase64ToObject
Decodes a Base64 string to an object using Base64Util.- Parameters:
base64String- The Base64 string to decode.- Returns:
- The decoded object, or null if decoding fails.
-
loadClass
Loads a class with the specified name using ClassUtil.- Parameters:
className- The fully qualified name of the class to be loaded.
-
getColor
Gets the Color corresponding to the given color name using ColorUtil.- Parameters:
colorName- The name of the color as a string.- Returns:
- The Color corresponding to the given name, or null if no match is found.
-
getColorFromHex
Parses a hex color code to a Color using ColorUtil.- Parameters:
hex- The hex color code as a string (e.g., "#FF5733").- Returns:
- The Color corresponding to the hex color code, or null if the code is invalid.
-
createDustOptionsFromHex
public org.bukkit.Particle.DustOptions createDustOptionsFromHex(@NotNull @NotNull String hexColor, float size) Creates a Particle.DustOptions object using a hex color code.- Parameters:
hexColor- The hex color code as a string (e.g., "#FF5733").size- The size of the dust particle.- Returns:
- A Particle.DustOptions object with the specified color and size, or null if the color code is invalid.
-
hasPermission
public boolean hasPermission(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull String permission) Checks if the specified entity has the given permission using EntityUtil.- Parameters:
entity- The entity to check.permission- The permission to check for.- Returns:
trueif the entity has the specified permission,trueif the method is not found, orfalseif an exception occurs.
-
getPlayerExperience
public int getPlayerExperience(@NotNull @NotNull org.bukkit.entity.Player player) Gets the total experience of the specified player using ExperienceUtil.- Parameters:
player- The player to get the experience from.- Returns:
- The total experience of the player.
-
getExperienceAtLevel
public int getExperienceAtLevel(int level) Gets the experience required to reach a specific level using ExperienceUtil.- Parameters:
level- The level to get the experience for.- Returns:
- The experience required to reach the specified level.
-
getLevelFromExperience
public long getLevelFromExperience(long experience) Calculates the level from a given amount of experience using ExperienceUtil.- Parameters:
experience- The experience to calculate the level from.- Returns:
- The level corresponding to the given experience.
-
getDropPercent
public int getDropPercent(int experience, float percent) Calculates the drop percentage of experience using ExperienceUtil.- Parameters:
experience- The total experience.percent- The percentage to drop.- Returns:
- The experience drop amount.
-
getPlayerDropExperience
@Deprecated public int getPlayerDropExperience(@NotNull @NotNull org.bukkit.entity.Player player, float expStorePercent) Deprecated.This method is deprecated and will be removed in a future version. Use
Gets the amount of experience a player will drop upon death based on a percentage.getLevelFromExperience(long)instead.- Parameters:
player- The player to get the drop experience from.expStorePercent- The percentage of experience to drop.- Returns:
- The amount of experience to drop.
-
moveFile
Moves a file to a new location with a new name using FileUtil.- Parameters:
file- The file to be moved.name- The new name for the file.
-
copyFile
Deprecated.This method is deprecated and will be removed in a future version. Use
Copies a file to a new location with a new name using FileUtil.moveFile(File, String)instead.- Parameters:
file- The file to be copied.name- The new name for the copied file.
-
getInventorySize
public int getInventorySize(int size) Gets the appropriate inventory size based on the given size.- Parameters:
size- The size to be used for determining the inventory size.- Returns:
- The appropriate inventory size.
-
equipArmor
public void equipArmor(@NotNull @NotNull org.bukkit.inventory.Inventory inventory, @NotNull @NotNull org.bukkit.entity.Player player) Equips the player's armor from the given inventory.- Parameters:
inventory- The inventory containing the armor items.player- The player to be equipped with armor.
-
equipItems
public void equipItems(@NotNull @NotNull org.bukkit.inventory.Inventory inventory, @NotNull @NotNull org.bukkit.entity.Player player) Equips the player's inventory items from the given inventory.- Parameters:
inventory- The inventory containing the items.player- The player to be equipped with items.
-
inventoryToString
Converts the given inventory to a string representation.- Parameters:
inventory- The inventory to be converted.- Returns:
- The string representation of the inventory.
-
stringToInventory
public org.bukkit.inventory.Inventory stringToInventory(@NotNull @NotNull org.bukkit.inventory.InventoryHolder inventoryHolder, @NotNull @NotNull String string, @NotNull @NotNull String title) Converts a string representation of an inventory to an Inventory object.- Parameters:
inventoryHolder- The inventory holder.string- The string representation of the inventory.title- The title of the inventory.- Returns:
- The Inventory object.
-
getLibraryLoaderUtil
-
roundLocation
public org.bukkit.Location roundLocation(@NotNull @NotNull org.bukkit.Location location) Rounds the given location's coordinates to the nearest whole numbers.- Parameters:
location- The location to be rounded.- Returns:
- A new location with rounded coordinates.
-
locationToString
Converts a Location object to a string representation.- Parameters:
location- The location to be converted.- Returns:
- A string representation of the location in the format "world|x|y|z".
-
chunkToString
Converts a chunk's location to a string representation.- Parameters:
location- The location within the chunk.- Returns:
- A string representation of the chunk in the format "world|chunkX|chunkZ".
-
chunkStringToLocation
Converts a chunk string representation back to a Location object.- Parameters:
string- The string representation of the chunk in the format "world|chunkX|chunkZ".- Returns:
- A Location object representing the chunk.
-
stringToLocation
Converts a string representation of a location back to a Location object.- Parameters:
string- The string representation of the location in the format "world|x|y|z".- Returns:
- A Location object.
-
getClosestLocation
public org.bukkit.Location getClosestLocation(@NotNull @NotNull org.bukkit.Location locationBase, @NotNull @NotNull List<org.bukkit.Location> locationList) Finds the closest location to a given base location from a list of locations.- Parameters:
locationBase- The base location to compare against.locationList- The list of locations to search through.- Returns:
- The closest location to the base location, or null if the list is empty.
-
isAir
public boolean isAir(@NotNull @NotNull org.bukkit.Material material) Checks if the given material is an air block.- Parameters:
material- The material to check.- Returns:
- True if the material is air, false otherwise.
-
isLava
public boolean isLava(@NotNull @NotNull org.bukkit.Material material) Checks if the given material is lava.- Parameters:
material- The material to check.- Returns:
- True if the material is lava, false otherwise.
-
isSafeNotSolid
public boolean isSafeNotSolid(@NotNull @NotNull org.bukkit.Material material) Checks if the given material is not solid and is safe (i.e., not lava).- Parameters:
material- The material to check.- Returns:
- True if the material is not solid and safe, false otherwise.
-
isSafeSolid
public boolean isSafeSolid(@NotNull @NotNull org.bukkit.Material material) Checks if the given material is solid and safe (i.e., not lava).- Parameters:
material- The material to check.- Returns:
- True if the material is solid and safe, false otherwise.
-
isWater
public boolean isWater(@NotNull @NotNull org.bukkit.Material material) Checks if the given material is water.- Parameters:
material- The material to check.- Returns:
- True if the material is water, false otherwise.
-
isPlayerHead
public boolean isPlayerHead(@NotNull @NotNull org.bukkit.Material material) Checks if the given material is a player head.- Parameters:
material- The material to check.- Returns:
- True if the material is a player head, false otherwise.
-
isPlayerHead
Checks if the given material is a player head.- Parameters:
material- The material to check via string.- Returns:
- True if the material is a player head, false otherwise.
-
postLog
Posts the given log content to mclo.gs and returns the URL of the posted log.- Parameters:
content- The log content to be posted.- Returns:
- The URL of the posted log, or null if the post was unsuccessful.
-
getHighestInt
public int getHighestInt(@NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable String permission) Gets the highest integer value associated with a specific permission prefix for the player.- Parameters:
player- The player whose permissions are being checked.permission- The permission prefix to search for.- Returns:
- The highest integer value found for the specified permission prefix. Returns 0 if no such permission is found.
-
getHighestDouble
public double getHighestDouble(@NotNull @NotNull org.bukkit.entity.Player player, String permission) Gets the highest double value associated with a specific permission prefix for the player.- Parameters:
player- The player whose permissions are being checked.permission- The permission prefix to search for.- Returns:
- The highest double value found for the specified permission prefix. Returns 0 if no such permission is found.
-
swingMainHand
public void swingMainHand(@NotNull @NotNull org.bukkit.entity.Player player) Triggers the main hand swing animation for the specified player.- Parameters:
player- The player whose main hand swing animation is to be triggered.
-
copyResources
Copies resources from the plugin's JAR file to the specified output path.- Parameters:
inputPath- The path inside the JAR file to copy from.outputPath- The path on the file system to copy to.
-
copyResources
public void copyResources(@NotNull @NotNull String inputPath, @NotNull @NotNull String outputPath, boolean overwrite) Copies resources from the plugin's JAR file to the specified output path, with an option to overwrite existing files.- Parameters:
inputPath- The path inside the JAR file to copy from.outputPath- The path on the file system to copy to.overwrite- Whether to overwrite existing files.
-
getSkinSignature
Gets the skin signature of the specified entity if it is a player.- Parameters:
entity- The entity whose skin signature is to be retrieved.- Returns:
- The skin signature of the player, or null if the entity is not a player or the signature could not be retrieved.
-
setSkullTexture
public void setSkullTexture(@NotNull @NotNull org.bukkit.block.Skull skull, @NotNull @NotNull String name, @NotNull @NotNull String base64) Sets the texture of a Skull block.- Parameters:
skull- The Skull block.name- The name associated with the texture.base64- The Base64 encoded texture.
-
setSkullTexture
public void setSkullTexture(@NotNull @NotNull org.bukkit.inventory.meta.SkullMeta skullMeta, @NotNull @NotNull String name, @NotNull @NotNull String base64) Sets the texture of a Skull item stack.- Parameters:
skullMeta- The SkullMeta item meta.name- The name associated with the texture.base64- The Base64 encoded texture.
-
getTexture
Retrieves the texture of the specified entity.- Parameters:
entity- The entity from which to get the texture.- Returns:
- The Base64 encoded texture string, or null if not found.
-
getPlayerGameProfile
public com.mojang.authlib.GameProfile getPlayerGameProfile(@NotNull @NotNull org.bukkit.entity.Player player) Retrieves the GameProfile of the specified player.- Parameters:
player- The player from which to get the GameProfile.- Returns:
- The GameProfile of the player, or null if not found.
-
getUUID
Converts a string to a UUID.- Parameters:
string- The string to convert to a UUID.- Returns:
- The UUID if the string is a valid UUID format, otherwise null.
-
getLatestVersion
Gets the latest version of a resource from SpigotMC.- Parameters:
resourceId- The ID of the resource on SpigotMC.- Returns:
- The latest version of the resource as a String, or null if an error occurs.
-
isValidYAML
Checks if a given file is a valid YAML file.- Parameters:
file- The file to check.- Returns:
- True if the file is a valid YAML file, otherwise false.
-
isGrave
Deprecated.UseisGrave(Grave, Location)instead for precise location checking. This code is added for debugging purposes. Checks if the specified location is a grave's location.- Parameters:
grave- the grave to check. This always returns true for the provided grave's death location. For more precise checking, useisGrave(Grave, Location)with a specific location.- Returns:
- true if the location matches the grave's death location, false otherwise.
-
isGrave
public boolean isGrave(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.Location location) Checks if a given location matches the death location of a specific grave.- Parameters:
grave- the grave to checklocation- the location to compare with the grave's death location- Returns:
- true if the location matches the grave's death location, false otherwise.
-
getGraveAmount
public long getGraveAmount()Returns the total number of graves for all players.This method calls
getGraveAmount(Player)with anullargument to count graves without filtering by any specific player.- Returns:
- the total count of graves for all players.
-
getGraveAmount
public long getGraveAmount(@Nullable @Nullable org.bukkit.entity.Player targetPlayer) Returns the number of graves associated with a specified player.If
targetPlayeris provided, only graves owned by this player will be counted. IftargetPlayerisnull, all graves are counted.- Parameters:
targetPlayer- the player whose graves should be counted; ifnull, counts graves for all players.- Returns:
- the number of graves associated with
targetPlayer, or the total count of all graves iftargetPlayerisnull.
-
downloadAndReplacePlugin
public static void downloadAndReplacePlugin(long pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) throws IOException Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.- Parameters:
pluginId- The Spigot resource ID of the plugin.pluginName- The name of the plugin file (without the ".jar" extension).pluginsFolder- The path to the plugins' folder.- Throws:
IOException- If the download or file operations fail.
-
downloadAndReplacePlugin
public static void downloadAndReplacePlugin(String pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) throws IOException Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.- Parameters:
pluginId- The Spigot resource ID of the plugin.pluginName- The name of the plugin file (without the ".jar" extension).pluginsFolder- The path to the plugins' folder.- Throws:
IOException- If the download or file operations fail.
-
getGravesX
Retrieves the instance of theGravesclass.Warning: Using this method can have undesirable results. Unless you know what you are doing, We recommend using other methods.
- Returns:
- the
Gravesinstance.
-
getInstance
Gets the instance of the GravesXAPI.- Returns:
- The instance of the API.
-
register
public void register()Registers the API as an event listener in the plugin manager.
-