gt: 	protected List<Block> generatePerimeter() {
context: package com.goldrushmc.bukkit.train.station;
  
  import java.util.ArrayList;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Set;
  
  import org.bukkit.Location;
  import org.bukkit.Material;
  import org.bukkit.World;
  import org.bukkit.block.Block;
  import org.bukkit.block.BlockFace;
  import org.bukkit.block.Sign;
  import org.bukkit.entity.EntityType;
  import org.bukkit.entity.HumanEntity;
  import org.bukkit.entity.Player;
  import org.bukkit.plugin.java.JavaPlugin;
  
  import com.bergerkiller.bukkit.tc.controller.MinecartGroup;
  import com.bergerkiller.bukkit.tc.controller.MinecartMember;
  import com.bergerkiller.bukkit.tc.controller.MinecartMemberStore;
  import com.bergerkiller.bukkit.tc.controller.type.MinecartMemberChest;
  import com.bergerkiller.bukkit.tc.controller.type.MinecartMemberFurnace;
  import com.bergerkiller.bukkit.tc.controller.type.MinecartMemberRideable;
  import com.bergerkiller.bukkit.tc.properties.CartProperties;
  import com.bergerkiller.bukkit.tc.properties.TrainProperties;
  import com.goldrushmc.bukkit.db.TrainScheduleTbl;
  import com.goldrushmc.bukkit.db.TrainStationLocationTbl;
  import com.goldrushmc.bukkit.db.TrainStationTbl;
  import com.goldrushmc.bukkit.db.TrainTbl;
  import com.goldrushmc.bukkit.defaults.DBAccess;
  import com.goldrushmc.bukkit.defaults.DBTrainsAccessible;
  import com.goldrushmc.bukkit.train.SmallBlockMap;
  import com.goldrushmc.bukkit.train.listeners.TrainStationLis;
  import com.goldrushmc.bukkit.train.signs.ISignLogic;
  import com.goldrushmc.bukkit.train.signs.SignLogic;
  import com.goldrushmc.bukkit.train.signs.SignType;
  import com.goldrushmc.bukkit.train.util.TrainTools;
  
  /**
   * Will control the functionality behind train stations.
   *
   * @author Diremonsoon 
   * 
   */
  public abstract class TrainStation extends BlockFinder{
  
  	//For tracking of the stations.
  	protected static List<TrainStation> trainStations = new ArrayList<TrainStation>();
  	public static final Material defaultStop = Material.BEDROCK;
  	public static DBTrainsAccessible db;
  
  	protected String stationName;
  	protected volatile MinecartGroup departingTrain;
  	protected final ISignLogic signs;
  	protected final BlockFace direction;
  	protected volatile List<Player> visitors = new ArrayList<Player>();
  	protected List<HumanEntity> workers = new ArrayList<HumanEntity>();
  //	protected final List<Block> perimeter;
  	protected final List<Block> trainArea;
  	protected volatile List<MinecartGroup> trains = new ArrayList<MinecartGroup>();
  	protected final List<Block> rails;
  
  	/**
  	 * We require the JavaPlugin because this class must be able to access the database.
  	 * This is the standard constructor, with the default stop block material..
  	 * 
  	 * @param plugin
  	 * @param stationName
  	 * @param corners
  	 * @param world
  	 * @throws Exception 
  	 */
  	public TrainStation(final JavaPlugin plugin, final String stationName, final List<Location> markers, final World world) throws Exception {
  		super(world, markers);
  		if(db == null) db = new DBAccess(plugin);
  		this.stationName = stationName;
  		this.trainArea = generateTrainArea();
  		this.rails = findRails();
  		this.signs = generateSignLogic();
  		Sign dir = this.signs.getSign(SignType.TRAIN_STATION_DIRECTION);
  		BlockFace tempDir = null;
  		if(dir != null) {
  			tempDir = TrainTools.getDirection(dir.getLine(2));
  		}
  		
  		if(tempDir != null) {
  			this.direction = tempDir;	
  		}
  		else {
  			this.direction = BlockFace.SELF;
  		}
  //		findWorkers();
  		//Add to the list of stations for both the listener and static class instance! IMPORTANT
  		trainStations.add(this);
  		TrainStationLis.addStation(this);
  	}
  
  	/**
  	 * We require the JavaPlugin because this class must be able to access the database.
  	 * This is the standard constructor with a custom stop block material.
  	 * 
  	 * @param plugin
  	 * @param stationName
  	 * @param corners
  	 * @param world
  	 * @param stopMat
  	 * @throws Exception 
  	 */
  	public TrainStation(final JavaPlugin plugin, final String stationName, final List<Location> markers, final World world, Material stopMat) throws Exception {
  		super(world, markers);
  		if(db == null) db = new DBAccess(plugin);
  		this.stationName = stationName;
  		this.trainArea = generateTrainArea();
  		this.rails = findRails();
  		this.signs = generateSignLogic();
  		Sign dir = this.signs.getSign(SignType.TRAIN_STATION_DIRECTION);
  		BlockFace tempDir = null;
  		if(dir != null) {
  			tempDir = TrainTools.getDirection(dir.getLine(2));
  		}
  		if(tempDir != null) {
  			this.direction = tempDir;	
  		}
  		else {
  			this.direction = BlockFace.SELF;
  		}
  //		findWorkers();
  
  		//Add to the list of stations for both the listener and static class instance! IMPORTANT
  		trainStations.add(this);
  		TrainStationLis.addStation(this);
  	}
  
  	public abstract void createTransport();
  
  	/**
  	 * Adds the train station to the database, in case of a server wide crash.
  	 */
  	public void addToDB(List<Location> coords) {
  		TrainStationTbl station = new TrainStationTbl();
  		station.setStationName(stationName);
  		Set<TrainStationLocationTbl> corners = new HashSet<TrainStationLocationTbl>();
  		List<Location> locs = coords;
  		for(int i = 0; i < 2; i++) {
  			TrainStationLocationTbl corner = new TrainStationLocationTbl();
  			corner.setStation(station);
  			corner.setX(locs.get(i).getBlockX());
  			corner.setY(locs.get(i).getBlockY());
  			corner.setZ(locs.get(i).getBlockZ());
  			corners.add(corner);
  		}
  		db.getDB().save(corners);
  		station.setCorners(corners);
  		db.getDB().save(station);
  	}
  
  
  	public MinecartGroup[] getDepartingTrains() {
  		long current = this.world.getTime();
  		MinecartGroup[] toDepart = new MinecartGroup[trains.size()];
  		for(MinecartGroup train : trains) {
  			TrainTbl check = db.getTrain(train.getProperties().getTrainName());
  			Set<TrainScheduleTbl> schedules = check.getSchedule();
  			int i = 0;
  			for(TrainScheduleTbl schedule : schedules) {
  				if(schedule.isNext()) {
  					long departure = schedule.getTimeToDepart();
  					if(departure == current) {
  						toDepart[i] = train;	
  					}						
  				}
  			}
  		}
  		return toDepart;
  	}
  
  	/**
  	 * Provides a standard way to sell carts.
  	 * 
  	 * @param owner
  	 * @param type
  	 */
  	public abstract void sellCart(Player owner, EntityType type);
  
  	/**
  	 * The default way for players to buy carts.
  	 * 
  	 * @param owner
  	 * @param type
  	 */
  	public abstract void buyCart(Player owner, EntityType type);
  
  	/**
  	 * A standard way to update the departure time for a single departing train.
  	 * 
  	 * @param time
  	 */
  	public void updateDepartureTime(MinecartGroup train, long time) {
  		if(train == null)  {
  			this.signs.getSign(SignType.TRAIN_STATION_TIME).setLine(2, "N/A");	
  		}
  		else {
  			this.signs.getSign(SignType.TRAIN_STATION_TIME).setLine(2, String.valueOf(time));	
  		}		
  		this.signs.getSign(SignType.TRAIN_STATION_TIME).update();
  	}
  
  	/**
  	 * A standard way to update the carts available for a single departing train.
  	 * 
  	 * @param type
  	 */
  	public void updateCartsAvailable(MinecartGroup train, EntityType type) {
  		if(train == null) {
  			this.signs.getSign(SignType.TRAIN_STATION_CART_COUNT).setLine(2, "0");
  			this.signs.getSign(SignType.TRAIN_STATION_CART_COUNT).update();
  			return;
  		}
  		train.size(type);
  		int countAvail = 0;
  		for(MinecartMember<?> cart : train) {
  			if(cart instanceof MinecartMemberFurnace) continue;
  			switch(type) {
  			case MINECART: if(cart instanceof MinecartMemberRideable) {
  				if(!cart.getProperties().hasOwners()) countAvail++;
  				break;
  			}
  			case MINECART_CHEST: if(cart instanceof MinecartMemberChest) {
  				if(!cart.getProperties().hasOwners()) countAvail++;
  				break;
  			}
  			default: break;
  			}
  		}
  		this.signs.getSign(SignType.TRAIN_STATION_CART_COUNT).setLine(2, String.valueOf(countAvail));
  		this.signs.getSign(SignType.TRAIN_STATION_CART_COUNT).update();
  	}
  	/**
  	 * The standard train creation method. This is an optional way to create a train with one furnace and one chest cart.
  	 * 
  	 * @param stop The {@link Block} to spawn the train on.
  	 */
  	public void createBuyableTrain(Block stop) {
  
  		if(this.trains == null) this.trains = new ArrayList<MinecartGroup>();
  		int trainNum = this.trains.size() + 1;
  
  		List<EntityType> carts = new ArrayList<EntityType>();
  		carts.add(EntityType.MINECART_CHEST);
  		carts.add(EntityType.MINECART_FURNACE);
  		//Should make the furnace spawn right on top of the stop block.
  		MinecartGroup train = MinecartGroup.spawn(stop, this.direction.getOppositeFace(), carts);
  		for(MinecartMember<?> mm : train) {
  			if(mm instanceof MinecartMemberChest) {
  				//				ItemStack coal = new ItemStack(Material.COAL, 64);
  				//				MinecartMemberChest coalChest = (MinecartMemberChest) mm;
  				//			coalChest.getEntity().getInventory().addItem(new ItemStack[]{coal, coal, coal, coal, coal, coal});			
  			}
  			if(mm instanceof MinecartMemberFurnace) {
  			}
  		}
  
  		TrainProperties tp = train.getProperties();
  		tp.setName(stationName + "_" + trainNum);
  		tp.setColliding(false);
  		tp.setSpeedLimit(0.4);
  		tp.setPublic(false);
  		tp.setManualMovementAllowed(false);
  		tp.setKeepChunksLoaded(true);
  		tp.setPickup(false);
  		train.setProperties(tp);
  
  		this.addTrain(train);
  		this.findNextDeparture();
  		this.changeSignLogic(train.getProperties().getTrainName());
  	}
  
  
  	/**
  	 * Creates a perimeter around the train station.
  	 * 
  	 * East = X + 1
  	 * West = X - 1
  	 * South = Z + 1
  	 * North = Z - 1
  	 * @return
  	 */
  