Class BlockTagManager
java.lang.Object
org.strassburger.lifestealz.util.customblocks.BlockTagManager
-
Method Summary
Modifier and TypeMethodDescriptionstatic <P,
C> C getBlockTag
(org.bukkit.block.Block block, org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<P, C> type) Gets a persistent data value from a blockstatic <P,
C> void tagBlock
(org.bukkit.block.Block block, org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<P, C> type, C value) Tags a block with a persistent data value
-
Method Details
-
tagBlock
public static <P,C> void tagBlock(org.bukkit.block.Block block, org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<P, C> type, C value) Tags a block with a persistent data value. [!!!] This method only works for blocks that have a TileState (like chests, furnaces, etc.).- Type Parameters:
P
- the type of the persistent data valueC
- the type of the value to set- Parameters:
block
- the block to tagkey
- the NamespacedKey to use for the tagtype
- the PersistentDataType to use for the tagvalue
- the value to set for the tag
-
getBlockTag
public static <P,C> C getBlockTag(org.bukkit.block.Block block, org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<P, C> type) Gets a persistent data value from a block. [!!!] This method only works for blocks that have a TileState (like chests, furnaces, etc.).- Type Parameters:
P
- the type of the persistent data valueC
- the type of the value to get- Parameters:
block
- the block to get the tag fromkey
- the NamespacedKey to use for the tagtype
- the PersistentDataType to use for the tag- Returns:
- the value of the tag, or null if not found
-