Package com.ranull.graves.compatibility
Class CompatibilityBlockData
java.lang.Object
com.ranull.graves.compatibility.CompatibilityBlockData
- All Implemented Interfaces:
Compatibility
An implementation of the Compatibility interface for handling block data.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidapplySkullData(org.bukkit.block.Skull skull, Grave grave, Graves plugin, int headType, String headBase64, String headName) Applies the skull data to the skull block.booleanChecks if a player can build at a given location.private StringextractSkullTexture(org.bukkit.inventory.meta.SkullMeta skullMeta) Extracts the texture of the skull from the SkullMeta.private StringgetEntityTexture(org.bukkit.entity.EntityType entityType) Gets the texture for a given entity type.org.bukkit.inventory.ItemStackgetSkullItemStack(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 BlockDatahandleBlockPlacement(org.bukkit.Location location, org.bukkit.Material material, Grave grave, Graves plugin) Handles the block placement logic.booleanhasTitleData(org.bukkit.block.Block block) Checks if a block has title data.private booleanisLevelledBlock(org.bukkit.block.Block block) Checks if the block is a Levelled block.private booleanisSpecialBlock(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 voidsetWaterlogged(org.bukkit.block.Block block, String originalMaterial) Sets the waterlogged state of the block.private voidupdateSkullBlock(org.bukkit.block.Block block, Grave grave, Graves plugin) Updates the skull block with the owner or texture data.
-
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:
setBlockDatain interfaceCompatibility- 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
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:
canBuildin interfaceCompatibility- 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:
hasTitleDatain interfaceCompatibility- Parameters:
block- The block to check.- Returns:
- True if the block has title data, false otherwise.
-
updateSkullBlock
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
Gets the skull item stack for a given grave.- Specified by:
getSkullItemStackin interfaceCompatibility- Parameters:
grave- The grave associated with the skull.plugin- The Graves plugin instance.- Returns:
- The ItemStack representing the skull.
-
getEntityTexture
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
Gets the texture of a skull item stack.- Specified by:
getSkullTexturein interfaceCompatibility- Parameters:
itemStack- The item stack representing the skull.- Returns:
- The texture of the skull as a string.
-
extractSkullTexture
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.
-