Fixed tree growth still being logged when disabled via config

This commit is contained in:
Intelli 2023-08-23 16:21:37 -06:00
parent af35a98b1d
commit 45d4642086
1 changed files with 7 additions and 1 deletions

View File

@ -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<BlockState> 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();