package fr.aumgn.diamondrush.region;

import java.util.ArrayList;
import java.util.List;

import org.bukkit.Material;
import org.bukkit.World;

import fr.aumgn.bukkit.util.Vector;
import fr.aumgn.diamondrush.region.patterns.FloorPattern;

public class GameSpawn extends Region {

    public GameSpawn(Vector pt) {
        super(pt.subtract(3, 1, 3), pt.add(3, 5, 3));
    }

    public List<Vector> getStartPositions(int size) {
        List<Vector> list = new ArrayList<Vector>(size);
        list.add(min.add(3, 1, 0));
        list.add(min.add(3, 1, 6));

        if (size > 2) {
            list.add(min.add(0, 1, 3));
        }
        if (size > 3) {
            list.add(min.add(6, 1, 3));
        }

        Vector middle = min.getMiddle(max);
        for (int i = 4; i < size; i++) {
            list.add(middle);
        }
        return list;
    }

    public void create(World world) {
        removeEverythingInside(world);
        FloorPattern base = new FloorPattern(
                min.to2D(), max.to2D(), min.getY(),
                Material.GLOWSTONE, (byte) 0, false);
        base.create(world);
    }
}

@@ -414,20 +414,22 @@
 ons(int 
-size
+amount
 ) %7B%0A    
@@ -474,20 +474,22 @@
 Vector%3E(
-size
+amount
 );%0A     
@@ -495,136 +495,129 @@
     
-list.add(min.add(3, 1, 0));%0A        list.add(min.add(3, 1, 6));%0A%0A        if (size %3E 2) %7B%0A            list.add(min.add(0, 1, 3));
+double angleDiff = 2 * Math.PI / amount;%0A        Vector middle = getMiddle();%0A%0A        for (int i = 0; i %3C amount; i++) %7B
 %0A   
@@ -625,80 +625,107 @@
     
-%7D%0A
     
-    if (size %3E 3) %7B%0A            list.add(min.add(6, 1,
+double angle = angleDiff * i;%0A            int x = (int) Math.round(Math.cos(angle) *
  3)
-)
 ;%0A      
   %7D%0A
@@ -724,97 +724,60 @@
     
-  %7D%0A%0A
       
-  Vector middle = min.getMiddle(max);%0A        for (int i = 4; i %3C size; i++) %7B
+int z = (int) Math.round(Math.sin(angle) * 3);
 %0A   
@@ -800,16 +800,41 @@
 d(middle
+.add(new Vector(x, 0, z))
 );%0A     
@@ -838,16 +838,17 @@
       %7D%0A
+%0A
         

Update start positions algorithm