<commit_before>package com.aaomidi.justskyblock.engine.generation;

import com.aaomidi.justskyblock.JustSkyblock;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.regions.Region;
import lombok.RequiredArgsConstructor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.util.Vector;

import java.io.File;


/**
 * @author aaomidi
 */
@RequiredArgsConstructor
public class IslandGeneration {
    private final JustSkyblock instance;
    private final BaseBlock AIR = new BaseBlock(Material.AIR.getId());

    // TODO: Re-Write so it doesn't try to spawn everything at the same time.
    private void buildIsland(Vector loc1, Vector loc2, World world, File file) {
        try {
            EditSession editSession = instance.getEngineManager().getWorldEditUtils().getEditSession(world);
            editSession.enableQueue();
            Region region = LocationsParser.getRegion(loc1, loc2);
            // Replacing the blocks is MUCH faster than just setting them all to air.
            editSession.replaceBlocks(region, null, AIR);
            editSession.flushQueue();
            // Loading schematics.
            CuboidClipboard cuboidClipboard = instance.getEngineManager().getWorldEditUtils().getCuboidClipboard(file);
            // Pasting the schematic.
            cuboidClipboard.paste(editSession, region.getCenter(), false);
            editSession.flushQueue();
            // Cause pokemon is awesome.
        } catch (Exception ex) {
            throw new RuntimeException("Problem with generating island.", ex);
        }

    }
    //TODO: Edit the generated island and add stuff to the chest.
    //TODO: Edit the generated island and edit the sign and add the player's name on there.


}
<commit_msg>Editing island after it generates.<commit_after>package com.aaomidi.justskyblock.engine.generation;

import com.aaomidi.justskyblock.JustSkyblock;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.regions.Region;
import lombok.RequiredArgsConstructor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.util.Vector;

import java.io.File;
import java.util.Iterator;


/**
 * @author aaomidi
 */
@RequiredArgsConstructor
public class IslandGeneration {
    private final JustSkyblock instance;
    private final BaseBlock AIR = new BaseBlock(Material.AIR.getId());
    // TODO: Re-Write so it doesn't try to spawn everything at the same time.

    /**
     * Clean up all blocks in a location and paste the island schematic instead.
     *
     * @param loc1  Minimum point of the island.
     * @param loc2  Maximum point of the island.
     * @param world World to create the island in.
     * @param file  Schematic file to load.
     */
    protected Region buildIsland(Vector loc1, Vector loc2, World world, File file) {
        try {
            EditSession editSession = instance.getEngineManager().getWorldEditUtils().getEditSession(world);
            editSession.enableQueue();
            Region region = LocationsParser.getRegion(loc1, loc2);
            // Replacing the blocks is MUCH faster than just setting them all to air.
            editSession.replaceBlocks(region, null, AIR);
            editSession.flushQueue();
            // Loading schematics.
            CuboidClipboard cuboidClipboard = instance.getEngineManager().getWorldEditUtils().getCuboidClipboard(file);
            // Pasting the schematic.
            cuboidClipboard.paste(editSession, region.getCenter(), false);
            editSession.flushQueue();
            // Cause pokemon is awesome.
            return region;
        } catch (Exception ex) {
            throw new RuntimeException("Problem with generating island.", ex);
        }
    }

    protected void editIsland(Region region) {
        Iterator<BlockVector> iterator = region.iterator();
        while (iterator.hasNext()) {
            BlockVector bv = iterator.next();
            World world = instance.getServer().getWorld(region.getWorld().getName());
            Block block = world.getBlockAt(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ());
            if (block.getType().equals(Material.CHEST)) {
                //TODO: Add items to chest.
            } else if (block.getType().equals(Material.WALL_SIGN) || block.getType().equals(Material.SIGN_POST) || block.getType().equals(Material.SIGN)) {
                //TODO: Edit the sign with a welcome message.
            }
        }
    }


}

{'fraction_non_alphanumeric': 0.09708944125770129, 'fraction_numerical': 0.005948587210537497, 'mean_word_length': 2.8973509933774833, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '6275266', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1278, 'n_words': 346}