Class Grave

java.lang.Object
com.ranull.graves.type.Grave
All Implemented Interfaces:
Serializable, org.bukkit.inventory.InventoryHolder

public class Grave extends Object implements org.bukkit.inventory.InventoryHolder, Serializable
Represents a grave in the game, storing information about the player or entity that the grave belongs to, including inventory, location, and various other attributes.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enum for defining different storage modes for the grave.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack>
    Map of equipment items, keyed by their respective equipment slots.
    private int
    The amount of experience associated with this instance.
    private org.bukkit.inventory.Inventory
    Inventory associated with this instance.
    private boolean
    Indicates whether grave is abandoned.
    private boolean
    Is the grave in a preview only state?
    private String
    The name of the killer.
    private String
    The display name of the killer.
    private org.bukkit.entity.EntityType
    The type of entity that is the killer.
    private UUID
    Unique identifier for the killer.
    private org.bukkit.Location
    The location associated with this instance.
    private LocationData
    Data representing the location of death.
    private String
    The name of the owner.
    private String
    The display name of the owner.
    private String
    The texture of the owner's avatar.
    private String
    The signature of the owner's texture.
    private org.bukkit.entity.EntityType
    The type of entity that owns this instance.
    private UUID
    Unique identifier for the owner.
    private List<String>
    List of permissions associated with this instance.
    private float
    The pitch rotation of the instance, in degrees.
    private boolean
    Indicates whether protection is enabled.
    private long
    The amount of time the instance has been alive, in milliseconds.
    private long
    The creation time of the instance, in milliseconds since the epoch.
    private long
    The duration of protection, in milliseconds.
    private final UUID
    Unique identifier for this instance.
    private float
    The yaw rotation of the instance, in degrees.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Grave(UUID uuid)
    Constructs a new Grave with the specified UUID.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack>
    Gets the equipment map for this grave.
    int
    Gets the experience points stored in the grave.
    boolean
    Gets the Preview state of a specific grave.
    @NotNull org.bukkit.inventory.Inventory
    Gets the inventory associated with this grave.
    List<org.bukkit.inventory.ItemStack>
    Gets a list of item stacks in the inventory.
    int
    Gets the number of items in the grave's inventory.
    Gets the name of the grave's killer.
    Gets the display name of the grave's killer.
    org.bukkit.entity.EntityType
    Gets the entity type of the grave's killer.
    Gets the UUID of the grave's killer.
    long
    Gets the total lived time (in milliseconds) since the grave was created.
    org.bukkit.Location
    Deprecated.
    This method is deprecated and will be removed in future versions.
    org.bukkit.Location
    Gets the death location of the grave.
    Retrieves the display name of the owner.
    Gets the name of the grave's owner.
    Gets the display name of the grave's owner.
    Gets the texture of the grave's owner.
    Gets the texture signature of the grave's owner.
    org.bukkit.entity.EntityType
    Gets the entity type of the grave's owner.
    Gets the UUID of the grave's owner.
    Gets the permission list associated with this grave.
    float
    Gets the pitch (vertical rotation) of the grave.
    boolean
    Checks if the grave has protection enabled.
    long
    Gets the time (in milliseconds) the grave is set to be alive.
    long
    Gets the remaining time (in milliseconds) the grave is set to be alive.
    long
    Gets the creation time (in milliseconds) of the grave.
    long
    Gets the protection time (in milliseconds) of the grave.
    long
    Gets the remaining time (in milliseconds) the grave is protected.
    Gets the UUID of the grave.
    float
    Gets the yaw (rotation) of the grave.
    boolean
    Determines if a grave was abandoned.
    void
    setAbandoned(boolean is_abandoned)
    Determines if a grave was abandoned.
    void
    setEquipmentMap(Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack> equipmentMap)
    Sets the equipment map for this grave.
    void
    setExperience(int experience)
    Sets the experience points for the grave.
    void
    setGravePreview(boolean isPreview)
    Sets the Preview state of a specific grave.
    void
    setInventory(org.bukkit.inventory.Inventory inventory)
    Sets the inventory for this grave.
    void
    setKillerName(String killerName)
    Sets the name of the grave's killer.
    void
    setKillerNameDisplay(String killerNameDisplay)
    Sets the display name of the grave's killer.
    void
    setKillerType(org.bukkit.entity.EntityType killerType)
    Sets the entity type of the grave's killer.
    void
    setKillerUUID(UUID killerUUID)
    Sets the UUID of the grave's killer.
    void
    setLocation(org.bukkit.Location location)
    Deprecated.
    This method is deprecated and will be removed in future versions.
    void
    setLocationDeath(org.bukkit.Location locationDeath)
    Sets the death location for the grave.
    void
    setOwnerDisplayName(String ownerNameDisplay)
    Sets the display name of the owner.
    void
    setOwnerName(String ownerName)
    Sets the name of the grave's owner.
    void
    setOwnerNameDisplay(String ownerNameDisplay)
    Sets the display name of the grave's owner.
    void
    setOwnerTexture(String ownerTexture)
    Sets the texture of the grave's owner.
    void
    setOwnerTextureSignature(String ownerTextureSignature)
    Sets the texture signature of the grave's owner.
    void
    setOwnerType(org.bukkit.entity.EntityType ownerType)
    Sets the entity type of the grave's owner.
    void
    setOwnerUUID(UUID ownerUUID)
    Sets the UUID of the grave's owner.
    void
    setPermissionList(List<String> permissionList)
    Sets the permission list for this grave.
    void
    setPitch(float pitch)
    Sets the pitch (vertical rotation) of the grave.
    void
    setProtection(boolean protection)
    Sets the protection status for the grave.
    void
    setTimeAlive(long aliveTime)
    Sets the time (in milliseconds) the grave is set to be alive.
    void
    setTimeAliveRemaining(long timeAlive)
    Sets the remaining time (in milliseconds) the grave is set to be alive.
    void
    setTimeCreation(long timeCreation)
    Sets the creation time (in milliseconds) of the grave.
    void
    setTimeProtection(long timeProtection)
    Sets the protection time (in milliseconds) of the grave.
    void
    setYaw(float yaw)
    Sets the yaw (rotation) of the grave.

    Methods inherited from class java.lang.Object

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

    • uuid

      private final UUID uuid
      Unique identifier for this instance.
    • inventory

      private transient org.bukkit.inventory.Inventory inventory
      Inventory associated with this instance. This field is marked as transient, meaning it will not be serialized.
    • equipmentMap

      private Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack> equipmentMap
      Map of equipment items, keyed by their respective equipment slots.
    • permissionList

      private List<String> permissionList
      List of permissions associated with this instance.
    • locationDeath

      private LocationData locationDeath
      Data representing the location of death.
    • yaw

      private float yaw
      The yaw rotation of the instance, in degrees.
    • pitch

      private float pitch
      The pitch rotation of the instance, in degrees.
    • ownerType

      private org.bukkit.entity.EntityType ownerType
      The type of entity that owns this instance.
    • ownerName

      private String ownerName
      The name of the owner.
    • ownerNameDisplay

      private String ownerNameDisplay
      The display name of the owner.
    • ownerUUID

      private UUID ownerUUID
      Unique identifier for the owner.
    • ownerTexture

      private String ownerTexture
      The texture of the owner's avatar.
    • ownerTextureSignature

      private String ownerTextureSignature
      The signature of the owner's texture.
    • killerType

      private org.bukkit.entity.EntityType killerType
      The type of entity that is the killer.
    • killerName

      private String killerName
      The name of the killer.
    • killerNameDisplay

      private String killerNameDisplay
      The display name of the killer.
    • killerUUID

      private UUID killerUUID
      Unique identifier for the killer.
    • experience

      private int experience
      The amount of experience associated with this instance.
    • protection

      private boolean protection
      Indicates whether protection is enabled.
    • is_abandoned

      private boolean is_abandoned
      Indicates whether grave is abandoned.
    • timeAlive

      private long timeAlive
      The amount of time the instance has been alive, in milliseconds.
    • timeCreation

      private long timeCreation
      The creation time of the instance, in milliseconds since the epoch.
    • timeProtection

      private long timeProtection
      The duration of protection, in milliseconds.
    • location

      private org.bukkit.Location location
      The location associated with this instance.
    • isPreview

      private boolean isPreview
      Is the grave in a preview only state?
  • Constructor Details

    • Grave

      public Grave(UUID uuid)
      Constructs a new Grave with the specified UUID.
      Parameters:
      uuid - The UUID of the grave.
  • Method Details

    • getInventory

      @NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()
      Gets the inventory associated with this grave.
      Specified by:
      getInventory in interface org.bukkit.inventory.InventoryHolder
      Returns:
      The inventory of the grave.
    • setInventory

      public void setInventory(org.bukkit.inventory.Inventory inventory)
      Sets the inventory for this grave.
      Parameters:
      inventory - The inventory to set.
    • getEquipmentMap

      public Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack> getEquipmentMap()
      Gets the equipment map for this grave.
      Returns:
      The equipment map.
    • setEquipmentMap

      public void setEquipmentMap(Map<org.bukkit.inventory.EquipmentSlot,org.bukkit.inventory.ItemStack> equipmentMap)
      Sets the equipment map for this grave.
      Parameters:
      equipmentMap - The equipment map to set.
    • getInventoryItemStack

      public List<org.bukkit.inventory.ItemStack> getInventoryItemStack()
      Gets a list of item stacks in the inventory.
      Returns:
      A list of item stacks.
    • getUUID

      public UUID getUUID()
      Gets the UUID of the grave.
      Returns:
      The UUID of the grave.
    • getPermissionList

      public List<String> getPermissionList()
      Gets the permission list associated with this grave.
      Returns:
      The permission list.
    • setPermissionList

      public void setPermissionList(List<String> permissionList)
      Sets the permission list for this grave.
      Parameters:
      permissionList - The permission list to set.
    • getLocationDeath

      public org.bukkit.Location getLocationDeath()
      Gets the death location of the grave.
      Returns:
      The death location.
    • setLocationDeath

      public void setLocationDeath(org.bukkit.Location locationDeath)
      Sets the death location for the grave.
      Parameters:
      locationDeath - The death location to set.
    • getYaw

      public float getYaw()
      Gets the yaw (rotation) of the grave.
      Returns:
      The yaw.
    • setYaw

      public void setYaw(float yaw)
      Sets the yaw (rotation) of the grave.
      Parameters:
      yaw - The yaw to set.
    • getPitch

      public float getPitch()
      Gets the pitch (vertical rotation) of the grave.
      Returns:
      The pitch.
    • setPitch

      public void setPitch(float pitch)
      Sets the pitch (vertical rotation) of the grave.
      Parameters:
      pitch - The pitch to set.
    • getOwnerType

      public org.bukkit.entity.EntityType getOwnerType()
      Gets the entity type of the grave's owner.
      Returns:
      The owner entity type.
    • setOwnerType

      public void setOwnerType(org.bukkit.entity.EntityType ownerType)
      Sets the entity type of the grave's owner.
      Parameters:
      ownerType - The owner entity type to set.
    • getOwnerName

      public String getOwnerName()
      Gets the name of the grave's owner.
      Returns:
      The owner name.
    • setOwnerName

      public void setOwnerName(String ownerName)
      Sets the name of the grave's owner.
      Parameters:
      ownerName - The owner name to set.
    • getOwnerNameDisplay

      public String getOwnerNameDisplay()
      Gets the display name of the grave's owner.
      Returns:
      The owner display name.
    • setOwnerNameDisplay

      public void setOwnerNameDisplay(String ownerNameDisplay)
      Sets the display name of the grave's owner.
      Parameters:
      ownerNameDisplay - The owner display name to set.
    • getOwnerUUID

      public UUID getOwnerUUID()
      Gets the UUID of the grave's owner.
      Returns:
      The owner UUID.
    • setOwnerUUID

      public void setOwnerUUID(UUID ownerUUID)
      Sets the UUID of the grave's owner.
      Parameters:
      ownerUUID - The owner UUID to set.
    • getOwnerTexture

      public String getOwnerTexture()
      Gets the texture of the grave's owner.
      Returns:
      The owner texture.
    • setOwnerTexture

      public void setOwnerTexture(String ownerTexture)
      Sets the texture of the grave's owner.
      Parameters:
      ownerTexture - The owner texture to set.
    • getOwnerTextureSignature

      public String getOwnerTextureSignature()
      Gets the texture signature of the grave's owner.
      Returns:
      The owner texture signature.
    • setOwnerTextureSignature

      public void setOwnerTextureSignature(String ownerTextureSignature)
      Sets the texture signature of the grave's owner.
      Parameters:
      ownerTextureSignature - The owner texture signature to set.
    • getKillerType

      public org.bukkit.entity.EntityType getKillerType()
      Gets the entity type of the grave's killer.
      Returns:
      The killer entity type.
    • setKillerType

      public void setKillerType(org.bukkit.entity.EntityType killerType)
      Sets the entity type of the grave's killer.
      Parameters:
      killerType - The killer entity type to set.
    • getKillerName

      public String getKillerName()
      Gets the name of the grave's killer.
      Returns:
      The killer name.
    • setKillerName

      public void setKillerName(String killerName)
      Sets the name of the grave's killer.
      Parameters:
      killerName - The killer name to set.
    • getKillerNameDisplay

      public String getKillerNameDisplay()
      Gets the display name of the grave's killer.
      Returns:
      The killer display name.
    • setKillerNameDisplay

      public void setKillerNameDisplay(String killerNameDisplay)
      Sets the display name of the grave's killer.
      Parameters:
      killerNameDisplay - The killer display name to set.
    • getKillerUUID

      public UUID getKillerUUID()
      Gets the UUID of the grave's killer.
      Returns:
      The killer UUID.
    • setKillerUUID

      public void setKillerUUID(UUID killerUUID)
      Sets the UUID of the grave's killer.
      Parameters:
      killerUUID - The killer UUID to set.
    • getExperience

      public int getExperience()
      Gets the experience points stored in the grave.
      Returns:
      The experience points.
    • setExperience

      public void setExperience(int experience)
      Sets the experience points for the grave.
      Parameters:
      experience - The experience points to set.
    • getProtection

      public boolean getProtection()
      Checks if the grave has protection enabled.
      Returns:
      True if protection is enabled, otherwise false.
    • setProtection

      public void setProtection(boolean protection)
      Sets the protection status for the grave.
      Parameters:
      protection - True to enable protection, otherwise false.
    • getTimeAlive

      public long getTimeAlive()
      Gets the time (in milliseconds) the grave is set to be alive.
      Returns:
      The time alive.
    • setTimeAlive

      public void setTimeAlive(long aliveTime)
      Sets the time (in milliseconds) the grave is set to be alive.
      Parameters:
      aliveTime - The time alive to set.
    • getTimeCreation

      public long getTimeCreation()
      Gets the creation time (in milliseconds) of the grave.
      Returns:
      The creation time.
    • setTimeCreation

      public void setTimeCreation(long timeCreation)
      Sets the creation time (in milliseconds) of the grave.
      Parameters:
      timeCreation - The creation time to set.
    • getTimeProtection

      public long getTimeProtection()
      Gets the protection time (in milliseconds) of the grave.
      Returns:
      The protection time.
    • setTimeProtection

      public void setTimeProtection(long timeProtection)
      Sets the protection time (in milliseconds) of the grave.
      Parameters:
      timeProtection - The protection time to set.
    • setTimeAliveRemaining

      public void setTimeAliveRemaining(long timeAlive)
      Sets the remaining time (in milliseconds) the grave is set to be alive. A value of -1 indicates the grave should not expire.
      Parameters:
      timeAlive - The new remaining time alive.
    • getTimeAliveRemaining

      public long getTimeAliveRemaining()
      Gets the remaining time (in milliseconds) the grave is set to be alive.
      Returns:
      The remaining time alive.
    • getTimeProtectionRemaining

      public long getTimeProtectionRemaining()
      Gets the remaining time (in milliseconds) the grave is protected.
      Returns:
      The remaining protection time.
    • getLivedTime

      public long getLivedTime()
      Gets the total lived time (in milliseconds) since the grave was created.
      Returns:
      The lived time.
    • isAbandoned

      public boolean isAbandoned()
      Determines if a grave was abandoned. Credit to Grave abandoning feature
      Returns:
      the abandoned grave.
    • setAbandoned

      public void setAbandoned(boolean is_abandoned)
      Determines if a grave was abandoned. Credit to Grave abandoning feature
      Parameters:
      is_abandoned - set grave as abandoned.
    • getItemAmount

      public int getItemAmount()
      Gets the number of items in the grave's inventory.
      Returns:
      The number of items.
    • getOwnerDisplayName

      public String getOwnerDisplayName()
      Retrieves the display name of the owner.

      This method returns the display name of the owner as a String.

      Returns:
      The display name of the owner.
    • setOwnerDisplayName

      public void setOwnerDisplayName(String ownerNameDisplay)
      Sets the display name of the owner.

      This method sets the display name of the owner to the specified String.

      Parameters:
      ownerNameDisplay - The display name to set for the owner.
    • getLocation

      @Deprecated public org.bukkit.Location getLocation()
      Deprecated.
      This method is deprecated and will be removed in future versions. Use getLocationDeath() instead for accurate location data. Retrieves the location associated with this instance.

      This method returns the location as a Location object.

      Returns:
      The location associated with this instance.
    • setGravePreview

      public void setGravePreview(boolean isPreview)
      Sets the Preview state of a specific grave.
      Parameters:
      isPreview - Sets the grave preview state.
    • getGravePreview

      public boolean getGravePreview()
      Gets the Preview state of a specific grave.
    • setLocation

      @Deprecated public void setLocation(org.bukkit.Location location)
      Deprecated.
      This method is deprecated and will be removed in future versions. Use setLocationDeath(Location) instead for accurate location data. Sets the location associated with this instance.

      This method sets the location to the specified Location.

      Parameters:
      location - The location to set.