Class CompatibilityBlockData

java.lang.Object
com.ranull.graves.compatibility.CompatibilityBlockData
All Implemented Interfaces:
Compatibility

public final class CompatibilityBlockData extends Object implements Compatibility
An implementation of the Compatibility interface for handling block data.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    applySkullData(org.bukkit.block.Skull skull, Grave grave, Graves plugin, int headType, String headBase64, String headName)
    Applies the skull data to the skull block.
    boolean
    canBuild(org.bukkit.entity.Player player, org.bukkit.Location location, Graves plugin)
    Checks if a player can build at a given location.
    private String
    extractSkullTexture(org.bukkit.inventory.meta.SkullMeta skullMeta)
    Extracts the texture of the skull from the SkullMeta.
    private String
    getEntityTexture(org.bukkit.entity.EntityType entityType)
    Gets the texture for a given entity type.
    org.bukkit.inventory.ItemStack
    getSkullItemStack(Grave grave, Graves plugin)
    Gets the skull item stack for a given grave.
    getSkullTexture(org.bukkit.inventory.ItemStack itemStack)
    Gets the texture of a skull item stack.
    private BlockData
    handleBlockPlacement(org.bukkit.Location location, org.bukkit.Material material, Grave grave, Graves plugin)
    Handles the block placement logic.
    boolean
    hasTitleData(org.bukkit.block.Block block)
    Checks if a block has title data.
    private boolean
    isLevelledBlock(org.bukkit.block.Block block)
    Checks if the block is a Levelled block.
    private boolean
    isSpecialBlock(org.bukkit.block.Block block)
    Checks if the block is a special block (Nether Portal or Openable).
    setBlockData(org.bukkit.Location location, org.bukkit.Material material, Grave grave, Graves plugin)
    Sets the block data for a given location and material, associating it with a grave.
    private void
    setWaterlogged(org.bukkit.block.Block block, String originalMaterial)
    Sets the waterlogged state of the block.
    private void
    updateSkullBlock(org.bukkit.block.Block block, Grave grave, Graves plugin)
    Updates the skull block with the owner or texture data.

    Methods inherited from class java.lang.Object

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

    • CompatibilityBlockData

      public CompatibilityBlockData()
  • Method Details

    • setBlockData

      public BlockData setBlockData(org.bukkit.Location location, org.bukkit.Material material, Grave grave, Graves plugin)
      Sets the block data for a given location and material, associating it with a grave.
      Specified by:
      setBlockData in interface Compatibility
      Parameters:
      location - The location where the block data should be set.
      material - The material of the block to set.
      grave - The grave associated with the block.
      plugin - The Graves plugin instance.
      Returns:
      The BlockData representing the set block data.
    • handleBlockPlacement

      private BlockData handleBlockPlacement(org.bukkit.Location location, org.bukkit.Material material, Grave grave, Graves plugin)
      Handles the block placement logic.
      Parameters:
      location - The location where the block data should be set.
      material - The material of the block to set.
      grave - The grave associated with the block.
      plugin - The Graves plugin instance.
      Returns:
      The BlockData representing the set block data.
    • isLevelledBlock

      private boolean isLevelledBlock(org.bukkit.block.Block block)
      Checks if the block is a Levelled block.
      Parameters:
      block - The block to check.
      Returns:
      True if the block is a Levelled block, false otherwise.
    • isSpecialBlock

      private boolean isSpecialBlock(org.bukkit.block.Block block)
      Checks if the block is a special block (Nether Portal or Openable).
      Parameters:
      block - The block to check.
      Returns:
      True if the block is a special block, false otherwise.
    • setWaterlogged

      private void setWaterlogged(org.bukkit.block.Block block, String originalMaterial)
      Sets the waterlogged state of the block.
      Parameters:
      block - The block to set the waterlogged state for.
      originalMaterial - The original material of the block.
    • canBuild

      public boolean canBuild(org.bukkit.entity.Player player, org.bukkit.Location location, Graves plugin)
      Checks if a player can build at a given location.
      Specified by:
      canBuild in interface Compatibility
      Parameters:
      player - The player to check.
      location - The location to check.
      plugin - The Graves plugin instance.
      Returns:
      True if the player can build at the location, false otherwise.
    • hasTitleData

      public boolean hasTitleData(org.bukkit.block.Block block)
      Checks if a block has title data.
      Specified by:
      hasTitleData in interface Compatibility
      Parameters:
      block - The block to check.
      Returns:
      True if the block has title data, false otherwise.
    • updateSkullBlock

      private void updateSkullBlock(org.bukkit.block.Block block, Grave grave, Graves plugin)
      Updates the skull block with the owner or texture data.
      Parameters:
      block - The skull block to update.
      grave - The grave associated with the skull.
      plugin - The Graves plugin instance.
    • applySkullData

      private void applySkullData(org.bukkit.block.Skull skull, Grave grave, Graves plugin, int headType, String headBase64, String headName)
      Applies the skull data to the skull block.
      Parameters:
      skull - The skull block.
      grave - The grave associated with the skull.
      plugin - The Graves plugin instance.
      headType - The type of head.
      headBase64 - The base64 encoded texture of the head.
      headName - The name of the head.
    • getSkullItemStack

      public org.bukkit.inventory.ItemStack getSkullItemStack(Grave grave, Graves plugin)
      Gets the skull item stack for a given grave.
      Specified by:
      getSkullItemStack in interface Compatibility
      Parameters:
      grave - The grave associated with the skull.
      plugin - The Graves plugin instance.
      Returns:
      The ItemStack representing the skull.
    • getEntityTexture

      private String getEntityTexture(org.bukkit.entity.EntityType entityType)
      Gets the texture for a given entity type.
      Parameters:
      entityType - The type of the entity.
      Returns:
      The texture of the entity as a string, or null if no texture is available.
    • getSkullTexture

      public String getSkullTexture(org.bukkit.inventory.ItemStack itemStack)
      Gets the texture of a skull item stack.
      Specified by:
      getSkullTexture in interface Compatibility
      Parameters:
      itemStack - The item stack representing the skull.
      Returns:
      The texture of the skull as a string.
    • extractSkullTexture

      private String extractSkullTexture(org.bukkit.inventory.meta.SkullMeta skullMeta)
      Extracts the texture of the skull from the SkullMeta.
      Parameters:
      skullMeta - The SkullMeta to extract the texture from.
      Returns:
      The texture of the skull as a string.