package eu.mhsl.minecraft.pixelblocks.listeners;

import eu.mhsl.minecraft.pixelblocks.utils.EventCanceling;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFromToEvent;

public class PreventLiquidsFlowListener implements Listener {
    @EventHandler
    public void onLiquidFlow(BlockFromToEvent event) {
        EventCanceling.shouldCancelInPixelBlock(
            event,
            event.getToBlock().getWorld(),
            pixelBlock -> !pixelBlock.getPixelWorld().allowPlacements(event.getToBlock().getLocation())
        );
    }
}
