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

public class BlockDataMock extends Object implements org.bukkit.block.data.BlockData
Mock implementation of BlockData. Also manages the creation of new BlockData with the appropriate mock class.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockDataMock(@NotNull org.bukkit.Material material)
    Constructs a new BlockDataMock for the provided Material.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static void
    checkMaterial(@NotNull org.bukkit.Material material)
    Ensures the provided material is valid for minecraft.
    protected void
    Ensures the provided material/state combination is valid for minecraft.
    protected void
    checkType(@NotNull org.bukkit.Material material, @NotNull org.bukkit.Material... expected)
    Ensures the provided material is one of the expected materials provided.
    protected void
    checkType(@NotNull org.bukkit.Material material, @NotNull org.bukkit.Tag<org.bukkit.Material> expected)
    Ensures the provided material is contained in the Tag.
    @NotNull BlockDataMock
     
    void
    copyTo(@NotNull org.bukkit.block.data.BlockData blockData)
     
    @NotNull org.bukkit.block.BlockState
     
    boolean
     
    protected <T> T
    get(@NotNull String key)
    Gets a data value.
    @NotNull String
     
    @NotNull String
    getAsString(boolean hideUnspecified)
     
    @NotNull org.bukkit.util.VoxelShape
    getCollisionShape(@NotNull org.bukkit.Location location)
     
    float
    getDestroySpeed(@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.SoundGroup
     
    int
     
    boolean
    isFaceSturdy(@NotNull org.bukkit.block.BlockFace face, @NotNull org.bukkit.block.BlockSupport support)
     
    boolean
     
    boolean
    isPreferredTool(@NotNull org.bukkit.inventory.ItemStack tool)
     
    boolean
     
    boolean
    isSupported(@NotNull org.bukkit.Location location)
     
    boolean
    isSupported(@NotNull org.bukkit.block.Block block)
     
    boolean
    matches(@Nullable org.bukkit.block.data.BlockData data)
     
    @NotNull org.bukkit.block.data.BlockData
    merge(@NotNull org.bukkit.block.data.BlockData data)
     
    void
    mirror(@NotNull org.bukkit.block.structure.Mirror mirror)
     
    static @NotNull BlockDataMock
    mock(@NotNull org.bukkit.Material material)
    Attempts to construct a BlockDataMock by the provided material.
    boolean
     
    void
    rotate(@NotNull org.bukkit.block.structure.StructureRotation rotation)
     
    protected <T> void
    set(@NotNull String key, T value)
    Sets a data value.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.bukkit.block.data.BlockData

    getDestroySpeed
  • Constructor Details

    • BlockDataMock

      public BlockDataMock(@NotNull @NotNull org.bukkit.Material material)
      Constructs a new BlockDataMock for the provided Material.
      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 the Tag.
      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

      protected void checkProperty(String property)
      Ensures the provided material/state combination is valid for minecraft.
      Parameters:
      property - The state to test.
    • set

      protected <T> void set(@NotNull @NotNull String key, @NotNull T value)
      Sets a data value.
      Type Parameters:
      T - The type of the data.
      Parameters:
      key - The data key.
      value - The data value.
      See Also:
      • BlockDataKey
    • get

      @NotNull protected <T> T get(@NotNull @NotNull String key)
      Gets a data value. Will throw an IllegalArgumentException if 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:
      • BlockDataKey
    • getMaterial

      @NotNull public @NotNull org.bukkit.Material getMaterial()
      Specified by:
      getMaterial in interface org.bukkit.block.data.BlockData
    • getAsString

      @NotNull public @NotNull String getAsString()
      Specified by:
      getAsString in interface org.bukkit.block.data.BlockData
    • getAsString

      @NotNull public @NotNull String getAsString(boolean hideUnspecified)
      Specified by:
      getAsString in interface org.bukkit.block.data.BlockData
    • merge

      @NotNull public @NotNull org.bukkit.block.data.BlockData merge(@NotNull @NotNull org.bukkit.block.data.BlockData data)
      Specified by:
      merge in interface org.bukkit.block.data.BlockData
    • getSoundGroup

      @NotNull public @NotNull org.bukkit.SoundGroup getSoundGroup()
      Specified by:
      getSoundGroup in interface org.bukkit.block.data.BlockData
    • getLightEmission

      public int getLightEmission()
      Specified by:
      getLightEmission in interface org.bukkit.block.data.BlockData
    • isOccluding

      public boolean isOccluding()
      Specified by:
      isOccluding in interface org.bukkit.block.data.BlockData
    • requiresCorrectToolForDrops

      public boolean requiresCorrectToolForDrops()
      Specified by:
      requiresCorrectToolForDrops in interface org.bukkit.block.data.BlockData
    • isSupported

      public boolean isSupported(@NotNull @NotNull org.bukkit.block.Block block)
      Specified by:
      isSupported in interface org.bukkit.block.data.BlockData
    • isSupported

      public boolean isSupported(@NotNull @NotNull org.bukkit.Location location)
      Specified by:
      isSupported in interface org.bukkit.block.data.BlockData
    • isFaceSturdy

      public boolean isFaceSturdy(@NotNull @NotNull org.bukkit.block.BlockFace face, @NotNull @NotNull org.bukkit.block.BlockSupport support)
      Specified by:
      isFaceSturdy in interface org.bukkit.block.data.BlockData
    • getCollisionShape

      @NotNull public @NotNull org.bukkit.util.VoxelShape getCollisionShape(@NotNull @NotNull org.bukkit.Location location)
      Specified by:
      getCollisionShape in interface org.bukkit.block.data.BlockData
    • getMapColor

      @NotNull public @NotNull org.bukkit.Color getMapColor()
      Specified by:
      getMapColor in interface org.bukkit.block.data.BlockData
    • getPlacementMaterial

      @NotNull public @NotNull org.bukkit.Material getPlacementMaterial()
      Specified by:
      getPlacementMaterial in interface org.bukkit.block.data.BlockData
    • rotate

      public void rotate(@NotNull @NotNull org.bukkit.block.structure.StructureRotation rotation)
      Specified by:
      rotate in interface org.bukkit.block.data.BlockData
    • mirror

      public void mirror(@NotNull @NotNull org.bukkit.block.structure.Mirror mirror)
      Specified by:
      mirror in interface org.bukkit.block.data.BlockData
    • copyTo

      public void copyTo(@NotNull @NotNull org.bukkit.block.data.BlockData blockData)
      Specified by:
      copyTo in interface org.bukkit.block.data.BlockData
    • createBlockState

      @NotNull public @NotNull org.bukkit.block.BlockState createBlockState()
      Specified by:
      createBlockState in interface org.bukkit.block.data.BlockData
    • getDestroySpeed

      public float getDestroySpeed(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, boolean considerEnchants)
      Specified by:
      getDestroySpeed in interface org.bukkit.block.data.BlockData
    • isRandomlyTicked

      public boolean isRandomlyTicked()
      Specified by:
      isRandomlyTicked in interface org.bukkit.block.data.BlockData
    • isPreferredTool

      public boolean isPreferredTool(@NotNull @NotNull org.bukkit.inventory.ItemStack tool)
      Specified by:
      isPreferredTool in interface org.bukkit.block.data.BlockData
    • getPistonMoveReaction

      @NotNull public @NotNull org.bukkit.block.PistonMoveReaction getPistonMoveReaction()
      Specified by:
      getPistonMoveReaction in interface org.bukkit.block.data.BlockData
    • matches

      public boolean matches(@Nullable @Nullable org.bukkit.block.data.BlockData data)
      Specified by:
      matches in interface org.bukkit.block.data.BlockData
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • clone

      @NotNull public @NotNull BlockDataMock clone()
      Specified by:
      clone in interface org.bukkit.block.data.BlockData
      Overrides:
      clone in class Object
    • mock

      @NotNull public static @NotNull BlockDataMock mock(@NotNull @NotNull org.bukkit.Material material)
      Attempts to construct a BlockDataMock by the provided material. Will return a basic BlockDataMock if no implementation is found.
      Parameters:
      material - The material to create the BlockData from.
      Returns:
      The BlockData.