Class GraveManagementAPI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabandonGrave(@NotNull Grave grave) Marks the specified grave as abandoned, preventing further interaction.booleanaddItemToGraveSlot(@NotNull Grave grave, @NotNull org.bukkit.inventory.ItemStack itemStack, int slot) Adds an item to a specific grave inventory slot if that slot is empty.intaddItemToNextAvailableGraveSlot(@NotNull Grave grave, @NotNull org.bukkit.inventory.ItemStack itemStack) Adds an item to the next empty grave inventory slot.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.voidclearGraveProtection(@NotNull Grave grave) Clears protection from an existing grave.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.Gets loaded graves owned by the specified owner UUID.getGraves(@Nullable org.bukkit.entity.Player targetPlayer) Gets loaded graves owned by the specified player.Gets all loaded grave UUIDs.getGraveUUIDs(@Nullable UUID ownerUUID) Gets loaded grave UUIDs owned by the specified owner UUID.getGraveUUIDs(@Nullable org.bukkit.entity.Player targetPlayer) Gets loaded grave UUIDs owned by the specified player.@Nullable UUIDgetGraveViewerUUID(@NotNull Grave grave) Gets the UUID of the player currently viewing (locking) the specified grave.intgetNextAvailableGraveSlot(@NotNull Grave grave) Gets the next empty inventory slot for the specified grave.booleanhasAvailableGraveSlot(@NotNull Grave grave) Checks whether the specified grave has at least one empty inventory slot.booleanDeprecated.booleanChecks if a given location matches the death location of a specific grave.booleanisGraveLocked(@NotNull Grave grave) Checks whether the specified grave is currently locked (being viewed) by any player.booleanisGraveLocked(@NotNull Grave grave, @NotNull org.bukkit.entity.Player player) Checks whether the specified grave is locked by someone other than the provided player.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.voidsetGraveProtection(@NotNull Grave grave, boolean protectedGrave, long timeProtection) Updates the protection state and remaining protection time for an existing grave.booleansetItemInGraveSlot(@NotNull Grave grave, @NotNull org.bukkit.inventory.ItemStack itemStack, int slot) Sets an item in a specific grave inventory slot, replacing any existing item in that slot.booleantryGetGraveViewerUUID(@NotNull Grave grave, @NotNull UUID[] outViewer) Attempts to get the UUID of the player currently viewing (locking) a grave.
-
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
-
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.
-
getGraveUUIDs
-
getGraveUUIDs
@NotNull public @NotNull List<UUID> getGraveUUIDs(@Nullable @Nullable org.bukkit.entity.Player targetPlayer) Gets loaded grave UUIDs owned by the specified player.- Parameters:
targetPlayer- the player whose grave UUIDs should be returned; ifnull, all grave UUIDs are returned.- Returns:
- a list of loaded grave UUIDs.
-
getGraveUUIDs
-
getGraves
-
getGraves
-
isGraveLocked
Checks whether the specified grave is currently locked (being viewed) by any player.- Parameters:
grave- the grave to check- Returns:
trueif the grave is currently locked/in-use, otherwisefalse
-
isGraveLocked
public boolean isGraveLocked(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.entity.Player player) Checks whether the specified grave is locked by someone other than the provided player.- Parameters:
grave- the grave to checkplayer- the player attempting access- Returns:
trueif the grave is locked by another player, otherwisefalse
-
getGraveViewerUUID
-
tryGetGraveViewerUUID
public boolean tryGetGraveViewerUUID(@NotNull @NotNull Grave grave, @NotNull @NotNull UUID[] outViewer) Attempts to get the UUID of the player currently viewing (locking) a grave.If the grave is locked, the viewer UUID is written to
outViewer[0]and this method returnstrue. If the grave is not locked, this method returnsfalseandoutVieweris unchanged.- Parameters:
grave- the grave to checkoutViewer- output array to receive the viewer UUID inoutViewer[0](length >= 1)- Returns:
trueif the grave is locked, otherwisefalse- Throws:
GravesXIllegalArgumentException- ifoutViewer.length == 0
-
setGraveProtection
public void setGraveProtection(@NotNull @NotNull Grave grave, boolean protectedGrave, long timeProtection) Updates the protection state and remaining protection time for an existing grave.This intentionally lives in the grave management API so Skript support does not modify grave internals directly.
- Parameters:
grave- the grave to updateprotectedGrave- whether the grave should be protectedtimeProtection- the remaining protection time in milliseconds; ignored when protection is disabled
-
clearGraveProtection
Clears protection from an existing grave.- Parameters:
grave- the grave to update
-
getNextAvailableGraveSlot
Gets the next empty inventory slot for the specified grave.- Parameters:
grave- the grave to inspect- Returns:
- the next empty slot index, or
-1if no empty slot exists
-
hasAvailableGraveSlot
Checks whether the specified grave has at least one empty inventory slot.- Parameters:
grave- the grave to inspect- Returns:
trueif the grave has an empty slot, otherwisefalse
-
addItemToGraveSlot
public boolean addItemToGraveSlot(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, int slot) Adds an item to a specific grave inventory slot if that slot is empty.Slot numbers are raw Bukkit inventory slot indexes. The first slot is
0.- Parameters:
grave- the grave to updateitemStack- the item to addslot- the target slot index- Returns:
trueif the item was added, otherwisefalse
-
setItemInGraveSlot
public boolean setItemInGraveSlot(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, int slot) Sets an item in a specific grave inventory slot, replacing any existing item in that slot.Slot numbers are raw Bukkit inventory slot indexes. The first slot is
0.- Parameters:
grave- the grave to updateitemStack- the item to setslot- the target slot index- Returns:
trueif the item was set, otherwisefalse
-
addItemToNextAvailableGraveSlot
public int addItemToNextAvailableGraveSlot(@NotNull @NotNull Grave grave, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Adds an item to the next empty grave inventory slot.- Parameters:
grave- the grave to updateitemStack- the item to add- Returns:
- the slot index that received the item, or
-1if no slot was available
-
isGrave(Grave, Location)instead for precise location checking.