forked from github-mirror/CoreProtect
Fixed Crimson/Warped fungus growth not respecting mushroom-growth (fixes #866)
This commit is contained in:
1 parent
99130fdcdb
commit
7dbd928edc
1 file changed
+12
-4
@@ -27,20 +27,24 @@ public final class BlockFertilizeListener extends Queue implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (!Config.getConfig(block.getWorld()).BLOCK_PLACE) {
|
Config config = Config.getConfig(block.getWorld());
|
||||||
|
if (!config.BLOCK_PLACE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Material blockType = block.getType();
|
||||||
Location location = block.getLocation();
|
Location location = block.getLocation();
|
||||||
List<BlockState> blocks = event.getBlocks();
|
List<BlockState> blocks = event.getBlocks();
|
||||||
|
boolean singleBlockGrowth = blocks.size() == 1 && blocks.get(0).getLocation().equals(location);
|
||||||
|
boolean mushroomGrowthBlock = isMushroomGrowthBlock(blockType);
|
||||||
|
|
||||||
if (Tag.SAPLINGS.isTagged(block.getType()) && (!Config.getConfig(location.getWorld()).TREE_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) {
|
if (mushroomGrowthBlock && (!config.MUSHROOM_GROWTH || singleBlockGrowth)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (block.getType().name().toLowerCase(Locale.ROOT).contains("mushroom") && (!Config.getConfig(location.getWorld()).MUSHROOM_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) {
|
if (!mushroomGrowthBlock && Tag.SAPLINGS.isTagged(blockType) && (!config.TREE_GROWTH || singleBlockGrowth)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (block.getType() == Material.AIR && blocks.size() > 1 && Tag.LOGS.isTagged(blocks.get(1).getType()) && !Config.getConfig(location.getWorld()).TREE_GROWTH) {
|
if (blockType == Material.AIR && blocks.size() > 1 && Tag.LOGS.isTagged(blocks.get(1).getType()) && !config.TREE_GROWTH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,4 +71,8 @@ public final class BlockFertilizeListener extends Queue implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isMushroomGrowthBlock(Material blockType) {
|
||||||
|
return blockType == Material.CRIMSON_FUNGUS || blockType == Material.WARPED_FUNGUS || blockType.name().toLowerCase(Locale.ROOT).contains("mushroom");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user