package moe.oko.opennaw.model;

import org.bukkit.Material;
import org.bukkit.block.Block;

import java.util.HashMap;
import java.util.List;

public class ExplosivesData {
    //The Block destroyed and the material it previously was.
    private HashMap<Block, Material> blocksDestroyed;
    private City city;

    public ExplosivesData(List<Block> blocks, City city) {
        blocksDestroyed = new HashMap<>();
        this.city = city;
        for(var block : blocks) {
            blocksDestroyed.put(block, block.getType());
        }
    }

    public void regenerate() {
        //Regenerate all blocks previously affected.
        for(var block : blocksDestroyed.keySet()) {
            block.setType(blocksDestroyed.get(block));
        }
    }

    public City getCity() { return city; }
}
