⬛Block Placer
Place blocks in any direction
Overview
The BlockPlacer
class provides a utility for programmatically placing blocks in a specified direction from a given origin location.
Methods
create
create
public static BlockPlacer create(JavaPlugin plugin, Material material)
Creates a new BlockPlacer
instance with the specified plugin and material.
Parameters
plugin
: The JavaPlugin instance associated with the plugin.material
: The material of the block to be placed.
Returns
Returns a new instance of the
BlockPlacer
class.
setDirection
setDirection
public BlockPlacer setDirection(Direction direction)
Sets the direction in which blocks will be placed.
Parameters
direction
: The direction in which blocks will be placed. Should be one of the values defined in theDirection
enum.
Returns
Returns the updated
BlockPlacer
instance.
setLength
setLength
public BlockPlacer setLength(int length)
Sets the number of blocks to be placed in the specified direction.
Parameters
length
: The number of blocks to be placed.
Returns
Returns the updated
BlockPlacer
instance.
setHeight
setHeight
public BlockPlacer setHeight(int height)
Sets the height of the block column to be placed.
Parameters
height
: The height of the block column.
Returns
Returns the updated
BlockPlacer
instance.
setDelayBetweenBlocks
setDelayBetweenBlocks
public BlockPlacer setDelayBetweenBlocks(long delay)
Sets the delay between placing each block in milliseconds.
Parameters
delay
: The delay between placing each block in milliseconds.
Returns
Returns the updated
BlockPlacer
instance.
build
build
public void build(Location origin)
Builds the block column starting from the specified origin location.
Parameters
origin
: The origin location from which to start placing blocks.
Returns
This method does not return anything.
Enums
Direction
Direction
Represents the direction in which blocks will be placed.
Example Usage
JavaPlugin plugin = // your plugin instance
Material material = Material.STONE;
Location origin = // your origin location
BlockPlacer.create(plugin, material)
.setDirection(BlockPlacer.Direction.UP)
.setLength(10)
.setHeight(5)
.setDelayBetweenBlocks(100)
.build(origin);
In this example, we create a BlockPlacer
instance, set its properties, and build a column of blocks starting from the specified origin location.
Last updated