Class GraveManagementAPI

java.lang.Object
dev.cwhead.GravesX.api.grave.GraveManagementAPI

public final class GraveManagementAPI extends Object
API for managing existing graves.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    abandonGrave(@NotNull Grave grave)
    Marks the specified grave as abandoned, preventing further interaction.
    void
    autoLootGrave(@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.
    void
    breakGrave(@NotNull Grave grave)
    Breaks the specified grave, triggering its removal and handling any related events.
    void
    breakGrave(@NotNull org.bukkit.Location location, @NotNull Grave grave)
    Breaks the specified grave at a given location.
    void
    dropGraveItems(@NotNull org.bukkit.Location location, @NotNull Grave grave)
    Drops the items stored in the specified grave at the given location.
    getGrave(@NotNull UUID uuid)
    Gets the grave type
    long
    Returns the total number of graves for all players.
    long
    getGraveAmount(@Nullable org.bukkit.entity.Player targetPlayer)
    Returns the number of graves associated with a specified player.
    boolean
    isGrave(@NotNull Grave grave)
    Deprecated.
    Use isGrave(Grave, Location) instead for precise location checking.
    boolean
    isGrave(@NotNull Grave grave, @NotNull org.bukkit.Location location)
    Checks if a given location matches the death location of a specific grave.
    boolean
    isNearGrave(@NotNull org.bukkit.Location location)
    Determines if the specified location is near a grave.
    boolean
    isNearGrave(@NotNull org.bukkit.Location location, @NotNull org.bukkit.block.Block block)
    Determines if the specified location is near a grave, considering a specific block.
    boolean
    isNearGrave(@NotNull org.bukkit.Location location, @NotNull org.bukkit.entity.Player player)
    Determines if the specified location is near a grave, considering a specific player.
    boolean
    isNearGrave(@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.
    void
    removeGrave(@NotNull Grave grave)
    Removes the specified grave from the grave manager.
    void
    removeOldestGrave(@NotNull org.bukkit.entity.LivingEntity livingEntity)
    Removes the oldest grave associated with the specified living entity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GraveManagementAPI

      public GraveManagementAPI(Graves plugin)
  • Method Details

    • removeGrave

      public void removeGrave(@NotNull @NotNull Grave grave)
      Removes the specified grave from the grave manager.
      Parameters:
      grave - the grave to be removed
    • breakGrave

      public void breakGrave(@NotNull @NotNull Grave grave)
      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 located
      grave - 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 grave
      location - the location of the grave
      grave - the grave to be looted
    • abandonGrave

      public void abandonGrave(@NotNull @NotNull Grave grave)
      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 dropped
      grave - 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:
      true if the location is near a grave, otherwise false.
    • 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:
      true if the location is near a grave, otherwise false.
    • 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:
      true if the location is near a grave, otherwise false.
    • 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:
      true if the location is near a grave, otherwise false.
    • getGrave

      public Grave getGrave(@NotNull @NotNull UUID uuid)
      Gets the grave type
      Parameters:
      uuid - the uuid of the grave
    • isGrave

      @Deprecated public boolean isGrave(@NotNull @NotNull Grave grave)
      Deprecated.
      Use isGrave(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, use isGrave(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 check
      location - 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 a null argument 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 targetPlayer is provided, only graves owned by this player will be counted. If targetPlayer is null, all graves are counted.

      Parameters:
      targetPlayer - the player whose graves should be counted; if null, counts graves for all players.
      Returns:
      the number of graves associated with targetPlayer, or the total count of all graves if targetPlayer is null.