Class BlockDataMock
java.lang.Object
be.seeseemelk.mockbukkit.block.data.BlockDataMock
- All Implemented Interfaces:
Cloneable,org.bukkit.block.data.BlockData
- Direct Known Subclasses:
AmethystClusterMock,BedMock,CampfireMock,SlabMock,StairsMock,SwitchMock,TrapDoorMock,WallSignMock
Mock implementation of
BlockData.
Also manages the creation of new BlockData with the appropriate mock class.-
Constructor Summary
ConstructorsConstructorDescriptionBlockDataMock(@NotNull org.bukkit.Material material) Constructs a newBlockDataMockfor the providedMaterial. -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidcheckMaterial(@NotNull org.bukkit.Material material) Ensures the provided material is valid for minecraft.protected voidcheckProperty(String property) Ensures the provided material/state combination is valid for minecraft.protected voidcheckType(@NotNull org.bukkit.Material material, @NotNull org.bukkit.Material... expected) Ensures the provided material is one of the expected materials provided.protected voidcheckType(@NotNull org.bukkit.Material material, @NotNull org.bukkit.Tag<org.bukkit.Material> expected) Ensures the provided material is contained in theTag.@NotNull BlockDataMockclone()voidcopyTo(@NotNull org.bukkit.block.data.BlockData blockData) @NotNull org.bukkit.block.BlockStatebooleanprotected <T> TGets a data value.@NotNull String@NotNull StringgetAsString(boolean hideUnspecified) @NotNull org.bukkit.util.VoxelShapegetCollisionShape(@NotNull org.bukkit.Location location) floatgetDestroySpeed(@NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants) int@NotNull org.bukkit.Color@NotNull org.bukkit.Material@NotNull org.bukkit.block.PistonMoveReaction@NotNull org.bukkit.Material@NotNull org.bukkit.SoundGroupinthashCode()booleanisFaceSturdy(@NotNull org.bukkit.block.BlockFace face, @NotNull org.bukkit.block.BlockSupport support) booleanbooleanisPreferredTool(@NotNull org.bukkit.inventory.ItemStack tool) booleanbooleanisSupported(@NotNull org.bukkit.Location location) booleanisSupported(@NotNull org.bukkit.block.Block block) booleanmatches(@Nullable org.bukkit.block.data.BlockData data) @NotNull org.bukkit.block.data.BlockDatamerge(@NotNull org.bukkit.block.data.BlockData data) voidmirror(@NotNull org.bukkit.block.structure.Mirror mirror) static @NotNull BlockDataMockmock(@NotNull org.bukkit.Material material) Attempts to construct a BlockDataMock by the provided material.booleanvoidrotate(@NotNull org.bukkit.block.structure.StructureRotation rotation) protected <T> voidSets a data value.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bukkit.block.data.BlockData
getDestroySpeed
-
Constructor Details
-
BlockDataMock
public BlockDataMock(@NotNull @NotNull org.bukkit.Material material) Constructs a newBlockDataMockfor the providedMaterial.- Parameters:
material- The material this data is for.
-
-
Method Details
-
checkType
protected void checkType(@NotNull @NotNull org.bukkit.Material material, @NotNull @NotNull org.bukkit.Material... expected) Ensures the provided material is one of the expected materials provided.- Parameters:
material- The material to test.expected- The expected materials.
-
checkType
protected void checkType(@NotNull @NotNull org.bukkit.Material material, @NotNull @NotNull org.bukkit.Tag<org.bukkit.Material> expected) Ensures the provided material is contained in theTag.- Parameters:
material- The material to test.expected- The expected tag.
-
checkMaterial
protected static void checkMaterial(@NotNull @NotNull org.bukkit.Material material) Ensures the provided material is valid for minecraft.- Parameters:
material- The material to test.
-
checkProperty
Ensures the provided material/state combination is valid for minecraft.- Parameters:
property- The state to test.
-
set
Sets a data value.- Type Parameters:
T- The type of the data.- Parameters:
key- The data key.value- The data value.- See Also:
-
get
Gets a data value. Will throw anIllegalArgumentExceptionif no data is set for the provided key.- Type Parameters:
T- The type of the data.- Parameters:
key- The data key.- Returns:
- The data attached to the key.
- See Also:
-
getMaterial
@NotNull public @NotNull org.bukkit.Material getMaterial()- Specified by:
getMaterialin interfaceorg.bukkit.block.data.BlockData
-
getAsString
- Specified by:
getAsStringin interfaceorg.bukkit.block.data.BlockData
-
getAsString
- Specified by:
getAsStringin interfaceorg.bukkit.block.data.BlockData
-
merge
@NotNull public @NotNull org.bukkit.block.data.BlockData merge(@NotNull @NotNull org.bukkit.block.data.BlockData data) - Specified by:
mergein interfaceorg.bukkit.block.data.BlockData
-
getSoundGroup
@NotNull public @NotNull org.bukkit.SoundGroup getSoundGroup()- Specified by:
getSoundGroupin interfaceorg.bukkit.block.data.BlockData
-
getLightEmission
public int getLightEmission()- Specified by:
getLightEmissionin interfaceorg.bukkit.block.data.BlockData
-
isOccluding
public boolean isOccluding()- Specified by:
isOccludingin interfaceorg.bukkit.block.data.BlockData
-
requiresCorrectToolForDrops
public boolean requiresCorrectToolForDrops()- Specified by:
requiresCorrectToolForDropsin interfaceorg.bukkit.block.data.BlockData
-
isSupported
public boolean isSupported(@NotNull @NotNull org.bukkit.block.Block block) - Specified by:
isSupportedin interfaceorg.bukkit.block.data.BlockData
-
isSupported
public boolean isSupported(@NotNull @NotNull org.bukkit.Location location) - Specified by:
isSupportedin interfaceorg.bukkit.block.data.BlockData
-
isFaceSturdy
public boolean isFaceSturdy(@NotNull @NotNull org.bukkit.block.BlockFace face, @NotNull @NotNull org.bukkit.block.BlockSupport support) - Specified by:
isFaceSturdyin interfaceorg.bukkit.block.data.BlockData
-
getCollisionShape
@NotNull public @NotNull org.bukkit.util.VoxelShape getCollisionShape(@NotNull @NotNull org.bukkit.Location location) - Specified by:
getCollisionShapein interfaceorg.bukkit.block.data.BlockData
-
getMapColor
@NotNull public @NotNull org.bukkit.Color getMapColor()- Specified by:
getMapColorin interfaceorg.bukkit.block.data.BlockData
-
getPlacementMaterial
@NotNull public @NotNull org.bukkit.Material getPlacementMaterial()- Specified by:
getPlacementMaterialin interfaceorg.bukkit.block.data.BlockData
-
rotate
public void rotate(@NotNull @NotNull org.bukkit.block.structure.StructureRotation rotation) - Specified by:
rotatein interfaceorg.bukkit.block.data.BlockData
-
mirror
public void mirror(@NotNull @NotNull org.bukkit.block.structure.Mirror mirror) - Specified by:
mirrorin interfaceorg.bukkit.block.data.BlockData
-
copyTo
public void copyTo(@NotNull @NotNull org.bukkit.block.data.BlockData blockData) - Specified by:
copyToin interfaceorg.bukkit.block.data.BlockData
-
createBlockState
@NotNull public @NotNull org.bukkit.block.BlockState createBlockState()- Specified by:
createBlockStatein interfaceorg.bukkit.block.data.BlockData
-
getDestroySpeed
public float getDestroySpeed(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants) - Specified by:
getDestroySpeedin interfaceorg.bukkit.block.data.BlockData
-
isRandomlyTicked
public boolean isRandomlyTicked()- Specified by:
isRandomlyTickedin interfaceorg.bukkit.block.data.BlockData
-
isPreferredTool
public boolean isPreferredTool(@NotNull @NotNull org.bukkit.inventory.ItemStack tool) - Specified by:
isPreferredToolin interfaceorg.bukkit.block.data.BlockData
-
getPistonMoveReaction
@NotNull public @NotNull org.bukkit.block.PistonMoveReaction getPistonMoveReaction()- Specified by:
getPistonMoveReactionin interfaceorg.bukkit.block.data.BlockData
-
matches
public boolean matches(@Nullable @Nullable org.bukkit.block.data.BlockData data) - Specified by:
matchesin interfaceorg.bukkit.block.data.BlockData
-
hashCode
public int hashCode() -
equals
-
clone
-
mock
Attempts to construct a BlockDataMock by the provided material. Will return a basicBlockDataMockif no implementation is found.- Parameters:
material- The material to create the BlockData from.- Returns:
- The BlockData.
-