<commit_before>package com.elmakers.mine.bukkit.block;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector;

import com.elmakers.mine.bukkit.api.block.BlockData;

public class BlockList implements com.elmakers.mine.bukkit.api.block.BlockList {

    protected BoundingBox          		area;
    protected String					worldName;

    protected LinkedList<BlockData> 	blockList;
    protected HashSet<Long>        		blockIdMap;

    public BlockList()
    {

    }

    public BlockList(BlockList other)
    {
        this.worldName = other.worldName;
        for (BlockData block : other)
        {
            BlockData newBlock = new com.elmakers.mine.bukkit.block.BlockData(block);
            add(newBlock);
        }
    }

    @Override
    public boolean add(Block block, boolean includeNeighbors)
    {
        boolean allAdded = add(block);
        if (includeNeighbors)
        {
            allAdded = add(block.getRelative(BlockFace.EAST)) && allAdded;
            allAdded = add(block.getRelative(BlockFace.NORTH)) && allAdded;
            allAdded = add(block.getRelative(BlockFace.WEST)) && allAdded;
            allAdded = add(block.getRelative(BlockFace.SOUTH)) && allAdded;
            allAdded = add(block.getRelative(BlockFace.UP)) && allAdded;
            allAdded = add(block.getRelative(BlockFace.DOWN)) && allAdded;
        }
        return allAdded;
    }

    @Override
    public boolean add(Block block)
    {
        if (contains(block))
        {
            return true;
        }
        BlockData newBlock = new com.elmakers.mine.bukkit.block.BlockData(block);
        return add(newBlock);
    }

    public boolean add(BlockData blockData)
    {
        // First do a sanity check with the map
        // Currently, we don't replace blocks!
        if (contains(blockData)) return true;

        // Check the world name<commit_msg>Don't auto-add neighbor blocks if they have been modified already<commit_after>package com.elmakers.mine.bukkit.block;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector;

import com.elmakers.mine.bukkit.api.block.BlockData;

public class BlockList implements com.elmakers.mine.bukkit.api.block.BlockList {

    protected BoundingBox          		area;
    protected String					worldName;

    protected LinkedList<BlockData> 	blockList;
    protected HashSet<Long>        		blockIdMap;

    public BlockList()
    {

    }

    public BlockList(BlockList other)
    {
        this.worldName = other.worldName;
        for (BlockData block : other)
        {
            BlockData newBlock = new com.elmakers.mine.bukkit.block.BlockData(block);
            add(newBlock);
        }
    }

    @Override
    public boolean add(Block block, boolean includeNeighbors)
    {
        boolean allAdded = add(block);
        if (includeNeighbors)
        {
            allAdded = addIfNew(block.getRelative(BlockFace.EAST)) && allAdded;
            allAdded = addIfNew(block.getRelative(BlockFace.NORTH)) && allAdded;
            allAdded = addIfNew(block.getRelative(BlockFace.WEST)) && allAdded;
            allAdded = addIfNew(block.getRelative(BlockFace.SOUTH)) && allAdded;
            allAdded = addIfNew(block.getRelative(BlockFace.UP)) && allAdded;
            allAdded = addIfNew(block.getRelative(BlockFace.DOWN)) && allAdded;
        }
        return allAdded;
    }

    public boolean addIfNew(Block block)
    {
        if (UndoList.getModified().containsKey(com.elmakers.mine.bukkit.block.BlockData.getBlockId(block)))
        {
            return false;
        }

        return add(block);
    }

    @Override
    public boolean add(Block block)
    {
        if (contains(block))
        {
            return true;
        }
        BlockData newBlock = new com.elmakers.mine.bukkit.block.BlockData(block);
        return add(newBlock);
    }

    public boolean add(BlockData blockData)
    {
        // First do a sanity check with the map
        // Currently, we don't replace blocks!
        if (contains(blockData)) return true;

        // Check the world name
{'fraction_non_alphanumeric': 0.09795570698466781, 'fraction_numerical': 0.0, 'mean_word_length': 2.566438876233865, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6200484', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1358, 'n_words': 284}