diff --git a/src/main/java/net/coreprotect/listener/block/BlockFertilizeListener.java b/src/main/java/net/coreprotect/listener/block/BlockFertilizeListener.java index ebe4850..325c608 100644 --- a/src/main/java/net/coreprotect/listener/block/BlockFertilizeListener.java +++ b/src/main/java/net/coreprotect/listener/block/BlockFertilizeListener.java @@ -4,11 +4,13 @@ import java.util.List; import java.util.Locale; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockFertilizeEvent; @@ -18,7 +20,7 @@ import net.coreprotect.thread.CacheHandler; public final class BlockFertilizeListener extends Queue implements Listener { - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) protected void onBlockFertilize(BlockFertilizeEvent event) { if (event.isCancelled()) { return; @@ -31,12 +33,16 @@ public final class BlockFertilizeListener extends Queue implements Listener { Location location = block.getLocation(); List blocks = event.getBlocks(); + if (Tag.SAPLINGS.isTagged(block.getType()) && (!Config.getConfig(location.getWorld()).TREE_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) { 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)))) { return; } + if (block.getType() == Material.AIR && blocks.size() > 1 && Tag.LOGS.isTagged(blocks.get(1).getType()) && !Config.getConfig(location.getWorld()).TREE_GROWTH) { + return; + } String user = "#bonemeal"; Player player = event.getPlayer();