Package redempt.redlib.multiblock
Class StructureData
java.lang.Object
redempt.redlib.multiblock.StructureData
Cross-version wrapper for block data -
BlockData
in 1.13+, MaterialData
otherwise-
Constructor Summary
ModifierConstructorDescriptionprotected
StructureData
(String string) StructureData
(org.bukkit.block.data.BlockData data) Creates a StructureData from a BlockData, for 1.13+StructureData
(org.bukkit.Material type) StructureData
(org.bukkit.Material type, byte data) Creates a StructureData from a Material and byte data, for 1.12 and below -
Method Summary
Modifier and TypeMethodDescriptionboolean
compare
(org.bukkit.block.Block block, boolean strict, boolean ignoreAir) Compares this StructureData to a BlockgetRotated
(Rotator rotator) org.bukkit.block.BlockState
getState
(org.bukkit.block.Block block) Gets the BlockState to set for a given blockorg.bukkit.Material
getType()
boolean
isAir()
void
sendBlock
(org.bukkit.entity.Player player, org.bukkit.Location loc) Sends a fake block change to a Playervoid
setBlock
(org.bukkit.block.Block block) Sets this StructureData at the given location
-
Constructor Details
-
StructureData
-
StructureData
public StructureData(org.bukkit.Material type) -
StructureData
public StructureData(org.bukkit.block.data.BlockData data) Creates a StructureData from a BlockData, for 1.13+- Parameters:
data
- The BlockData
-
StructureData
public StructureData(org.bukkit.Material type, byte data) Creates a StructureData from a Material and byte data, for 1.12 and below- Parameters:
type
- The block typedata
- The data byte
-
-
Method Details
-
getRotated
-
setBlock
public void setBlock(org.bukkit.block.Block block) Sets this StructureData at the given location- Parameters:
block
- The block to set
-
getState
public org.bukkit.block.BlockState getState(org.bukkit.block.Block block) Gets the BlockState to set for a given block- Parameters:
block
- The Block to get the BlockState at- Returns:
- The BlockState that would be set
-
sendBlock
public void sendBlock(org.bukkit.entity.Player player, org.bukkit.Location loc) Sends a fake block change to a Player- Parameters:
player
- The Player to send the fake block change toloc
- The Location of the fake block
-
isAir
public boolean isAir()- Returns:
- Whether the Material is air - for 1.15+, AIR, CAVE_AIR, or VOID_AIR
-
getType
public org.bukkit.Material getType()- Returns:
- The type of this StructureData
-
compare
public boolean compare(org.bukkit.block.Block block, boolean strict, boolean ignoreAir) Compares this StructureData to a Block- Parameters:
block
- The Block to compare withstrict
- Whether to compare strictlyignoreAir
- Whether to return true automatically if this StructureData is air- Returns:
- Whether the block matches this StructureData within the given parameters
-