Class BlockStateMock
java.lang.Object
org.mockbukkit.mockbukkit.block.state.BlockStateMock
- All Implemented Interfaces:
BlockState,Metadatable
- Direct Known Subclasses:
TileStateMock
Mock implementation of a
BlockState.
Also manages the creation of new BlockStates with the appropriate mock class.-
Constructor Summary
ConstructorsModifierConstructorDescriptionBlockStateMock(@NotNull Material material) Constructs a newBlockStateMockfor the providedMaterial.protectedBlockStateMock(@NotNull Block block) Constructs a newBlockStateMockfor the providedBlock.protectedBlockStateMock(@NotNull BlockStateMock state) Constructs a newBlockStateMockby cloning the data from an existing one. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidEnsures the provided material is one of the expected materials provided.protected voidEnsures the provided material is contained in theTag.protected voidEnsures the provided block type is one of the expected materials provided.protected voidEnsures the provided block type is contained in theTag.@NotNull BlockStateMockcopy()This returns a copy of thisBlockStateMock.@NotNull BlockStateboolean@NotNull BlockgetBlock()@NotNull BlockData@NotNull ChunkgetChunk()@NotNull MaterialDatagetData()Deprecated.@NotNull Collection<ItemStack> getDrops()@NotNull Collection<ItemStack> @NotNull Collection<ItemStack> byte@NotNull LocationgetLocation(Location loc) @NotNull List<MetadataValue> getMetadata(String metadataKey) byteDeprecated.@NotNull BlockStateMockThis returns a copy of thisBlockStateMock.@NotNull MaterialgetType()@NotNull WorldgetWorld()intgetX()intgetY()intgetZ()inthashCode()booleanhasMetadata(String metadataKey) booleanbooleanisPlaced()static @NotNull BlockStateMockstatic @NotNull BlockStateMockAttempts to construct a BlockStateMock by the provided block.voidremoveMetadata(String metadataKey, Plugin owningPlugin) voidsetBlockData(BlockData data) voidsetData(MaterialData data) Deprecated.voidsetMetadata(String metadataKey, @NotNull MetadataValue newMetadataValue) voidsetRawData(byte data) Deprecated.voidtoString()protected StringProvides the contents oftoString().booleanupdate()booleanupdate(boolean force) booleanupdate(boolean force, boolean applyPhysics)
-
Constructor Details
-
BlockStateMock
Constructs a newBlockStateMockfor the providedMaterial.- Parameters:
material- The material this state is for.
-
BlockStateMock
Constructs a newBlockStateMockfor the providedBlock.- Parameters:
block- The block this state is for.
-
BlockStateMock
Constructs a newBlockStateMockby cloning the data from an existing one.- Parameters:
state- The state to clone.
-
-
Method Details
-
checkType
protected void checkType(@NotNull @NotNull Material material, @NotNull @NotNull Material @NotNull ... expected) Ensures the provided material is one of the expected materials provided.- Parameters:
material- The material to test.expected- The expected materials.
-
checkType
Ensures the provided block type is one of the expected materials provided.- Parameters:
block- The block to test.expected- The expected materials.
-
checkType
protected void checkType(@NotNull @NotNull Material material, @NotNull @NotNull Tag<Material> expected) Ensures the provided material is contained in theTag.- Parameters:
material- The material to test.expected- The expected tag.
-
checkType
Ensures the provided block type is contained in theTag.- Parameters:
block- The material to test.expected- The expected tag.
-
setMetadata
- Specified by:
setMetadatain interfaceMetadatable
-
getMetadata
- Specified by:
getMetadatain interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadatain interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadatain interfaceMetadatable
-
getBlock
- Specified by:
getBlockin interfaceBlockState
-
getData
Deprecated.- Specified by:
getDatain interfaceBlockState
-
getType
- Specified by:
getTypein interfaceBlockState
-
getLightLevel
public byte getLightLevel()- Specified by:
getLightLevelin interfaceBlockState
-
getWorld
- Specified by:
getWorldin interfaceBlockState
-
getX
public int getX()- Specified by:
getXin interfaceBlockState
-
getY
public int getY()- Specified by:
getYin interfaceBlockState
-
getZ
public int getZ()- Specified by:
getZin interfaceBlockState
-
getLocation
- Specified by:
getLocationin interfaceBlockState
-
getLocation
- Specified by:
getLocationin interfaceBlockState
-
getChunk
- Specified by:
getChunkin interfaceBlockState
-
setData
Deprecated.- Specified by:
setDatain interfaceBlockState
-
setType
- Specified by:
setTypein interfaceBlockState
-
update
public boolean update()- Specified by:
updatein interfaceBlockState
-
update
public boolean update(boolean force) - Specified by:
updatein interfaceBlockState
-
update
public boolean update(boolean force, boolean applyPhysics) - Specified by:
updatein interfaceBlockState
-
getRawData
Deprecated.- Specified by:
getRawDatain interfaceBlockState
-
setRawData
Deprecated.- Specified by:
setRawDatain interfaceBlockState
-
isPlaced
public boolean isPlaced()- Specified by:
isPlacedin interfaceBlockState
-
isCollidable
public boolean isCollidable()- Specified by:
isCollidablein interfaceBlockState
-
getDrops
- Specified by:
getDropsin interfaceBlockState
-
getDrops
- Specified by:
getDropsin interfaceBlockState
-
getDrops
@NotNull public @NotNull Collection<ItemStack> getDrops(@NotNull @NotNull ItemStack tool, @Nullable @Nullable Entity entity) - Specified by:
getDropsin interfaceBlockState
-
getBlockData
- Specified by:
getBlockDatain interfaceBlockState
-
copy
This returns a copy of thisBlockStateMock. Inheriters of this class must override this method!- Specified by:
copyin interfaceBlockState- Returns:
- A copy of this
BlockStateMock.
-
copy
- Specified by:
copyin interfaceBlockState
-
setBlockData
- Specified by:
setBlockDatain interfaceBlockState
-
getSnapshot
This returns a copy of thisBlockStateMock. Inheriters of this class must override this method!- Returns:
- A snapshot of this
BlockStateMock.
-
hashCode
public int hashCode() -
equals
-
toString
-
toStringInternal
Provides the contents oftoString().Implementors must call super as in the following example.
@Override protected String toStringInternal() { return super.toStringInternal() + ", member1=" + member1 + ", member2=" + member2; }- Returns:
- Comma separated list of properties and values.
-
mockState
Attempts to construct a BlockStateMock by the provided block. Will return a basicBlockStateMockif no implementation is found.- Parameters:
block- The block to create the BlockState from.- Returns:
- The BlockState.
-
mockState
-