Package dev.cwhead.GravesX.api.grave
Class GraveManagementAPI
java.lang.Object
dev.cwhead.GravesX.api.grave.GraveManagementAPI
API for managing existing graves.
-
Constructor Summary
Constructors -
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.voiddropGraveItems(@NotNull org.bukkit.Location location, @NotNull Grave grave) Drops the items stored in the specified grave at the given location.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.booleanDeprecated.booleanChecks if a given location matches the death location of a specific grave.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.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.
-
Constructor Details
-
GraveManagementAPI
-
-
Method Details
-
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
-
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.
-
isGrave(Grave, Location)instead for precise location checking.