// Package Declaration
package com.crystalcraftmc.crystalspace.wgen.populators;

// Java Imports

import com.crystalcraftmc.crystalspace.handlers.ConfigHandler;
import com.crystalcraftmc.crystalspace.handlers.SpoutHandler;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.generator.BlockPopulator;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.block.SpoutBlock;

import java.util.Random;

// bSpace Imports
// Bukkit Imports
// Spout Imports

/**
 * Populates a world with black holes.
 *
 * @author kitskub
 * @author iffa
 */
public class SpaceBlackHolePopulator extends BlockPopulator {
    public static final int ID_TO_USE = 120; //for easier changing if needed
    private static boolean useSpout;

    public SpaceBlackHolePopulator(boolean spout) {
        useSpout = spout;
    }


    /**
     * Populates a chunk with black holes.
     *
     * @param world World
     * @param random Random
     * @param source Source chunk
     */
    @Override
    public void populate(World world, Random random, Chunk source) {
        String id = ConfigHandler.getID(world);
        if (withinSpawn(source)) {
            return;
        }
        if (random.nextInt(100) <= ConfigHandler.getBlackHoleChance(id)) {
            int chunkX = source.getX();
            int chunkZ = source.getZ();
            int x = random.nextInt(16);
            int z = random.nextInt(16);
            int y = random.nextInt(world.getMaxHeight());
            if(useSpout){
                SpoutBlock sb = (SpoutBlock) world.getBlockAt((chunkX * 16 + x), y, (chunkZ * 16 + z));
                SpoutManager.getMaterialManager().overrideBlock(sb, SpoutHandler.blackHole);
            }
            else {
                Block block = world.getBlockAt((chunkX * 16 + x), y, (chunkZ * 16 + z));
                block.setTypeId(ID_TO_USE);
            }
        }
    }

    /**
     * Checks if the source chunk is in the spawn area.
     * 
     * @param source Source chunk
     * 
     * @return True if within spawn
     */
    private boolean withinSpawn(Chunk source) {
        int x = source.getX();
        int z = source.getZ();

        if (x > -2 && x < 2 && z > -2 && z < 2) {
            return true;
        }
        return false;
    }
}

@@ -158,70 +158,8 @@
 er;%0A
-import com.crystalcraftmc.crystalspace.handlers.SpoutHandler;%0A
 impo
@@ -283,177 +283,33 @@
 or;%0A
-import org.getspout.spoutapi.SpoutManager;%0Aimport org.getspout.spoutapi.block.SpoutBlock;%0A%0Aimport java.util.Random;%0A%0A// bSpace Imports%0A// Bukkit Imports%0A// Spout Imports
+%0Aimport java.util.Random;
 %0A%0A/*
@@ -387,16 +387,36 @@
 or iffa%0A
+ * @author jflory7 %0A
  */%0Apubl
@@ -554,123 +554,47 @@
 ded%0A
-    private static boolean useSpout;%0A%0A    public SpaceBlackHolePopulator(boolean spout) %7B%0A        useSpout = spout;
+%0A    public SpaceBlackHolePopulator() %7B
 %0A   
@@ -883,16 +883,25 @@
 world);%0A
+        %0A
         
@@ -949,32 +949,41 @@
 turn;%0A        %7D%0A
+        %0A
         if (rand
@@ -1263,268 +1263,8 @@
 ));%0A
-            if(useSpout)%7B%0A                SpoutBlock sb = (SpoutBlock) world.getBlockAt((chunkX * 16 + x), y, (chunkZ * 16 + z));%0A                SpoutManager.getMaterialManager().overrideBlock(sb, SpoutHandler.blackHole);%0A            %7D%0A            else %7B%0A    
     
@@ -1356,20 +1356,16 @@
         
-    
 block.se
@@ -1388,22 +1388,8 @@
 E);%0A
-            %7D%0A
     
@@ -1678,20 +1678,23 @@
         
-if (
+return 
 x %3E -2 &
@@ -1723,67 +1723,8 @@
  %3C 2
-) %7B%0A            return true;%0A        %7D%0A        return false
 ;%0A  

Remove Spout support, correct imports