package de.steamwar.fightsystem.listener;

import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockFadeEvent;

public class BlockFadeListener implements Listener {

    public BlockFadeListener() {
        new StateDependentListener(Config.DisableSnowMelt, FightState.All, this);
    }

    @EventHandler
    public void onBlockFade(BlockFadeEvent event) {
        if (Config.ArenaRegion.inRegion(event.getBlock()) && (event.getBlock().getType() == Material.SNOW_BLOCK || event.getBlock().getType() == Material.SNOW || event.getBlock().getType() == Material.ICE)) {
            event.setCancelled(true);
        }
    }

}
