⬛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
createpublic 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
BlockPlacerclass.
setDirection
setDirectionpublic 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 theDirectionenum.
Returns
Returns the updated
BlockPlacerinstance.
setLength
setLengthpublic 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
BlockPlacerinstance.
setHeight
setHeightpublic 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
BlockPlacerinstance.
setDelayBetweenBlocks
setDelayBetweenBlockspublic 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
BlockPlacerinstance.
build
buildpublic 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
DirectionRepresents 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