A small plugin for replacing blocks with others. Often used in minecraft guild wars.
SMCSandBoy
- instance of plugin
ReplacerService
- manages and stores replacers
Replacer
- block replacement algorithm
ReplacerValidator
- checks if the algorithm can continue replacing
NextMove
- functional interface to get next location for replacing blocks
SMCSandBoy plugin = SMCSandBoy.getInstance();
ReplacerService service = plugin.getReplacerService();
StandardReplacer replacer = new StandardReplacer(Material.LAVA, NextMove.DOWN, ReplacerValidator.AIR_ONLY);
ItemBuilder item = new ItemBuilder(Material.LAPIS_BLOCK).setName("&9Mega Lava");
service.registerReplacer("custom_lava", replacer, item);
service.configuration()
.name("custom_water")
.replacer(new StandardReplacer(Material.WATER, NextMove.UP, ReplacerValidator.AIR_ONLY))
.item(new ItemBuilder(Material.LAPIS_BLOCK).setName("&9Mega Water"))
.register();
service.getReplacerData("boyFarmer").peek(replacerData -> {
Replacer replacer = replacerData.getReplacer();
replacer.addValidator((nextLocation, nextType, round) -> round < 20);
ItemBuilder item = replacerData.getItem();
item.setType(Material.STONE);
item.setName("&9Change Name");
replacerData.setItem(item);
});