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.BlockBreakEvent;

public class BreakPixelListener implements Listener {
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        EventCanceling.shouldCancelInPixelBlock(
            event,
            event.getBlock().getWorld(),
            pixelBlock -> !pixelBlock.getPixelWorld().allowPlacements(event.getBlock().getLocation())
        );
    }
}
