package uk.co.eluinhost.ultrahardcore.borders.types;

import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.patterns.SingleBlockPattern;
import com.sk89q.worldedit.regions.CuboidRegion;
import uk.co.eluinhost.ultrahardcore.borders.BorderParams;

public class SquareBorder extends WorldEditBorder {

    public static final int MAX_HEIGHT = 256;

    public SquareBorder() {
        super("Square", "Creates a square wall around the map");
    }

    @Override
    public void createBorder(BorderParams bp, EditSession es) throws MaxChangedBlocksException {
        Vector pos1 = new Vector(
                bp.getX() + bp.getRadius(),
                MAX_HEIGHT,
                bp.getZ() + bp.getRadius());
        Vector pos2 = new Vector(
                bp.getX() - bp.getRadius(),
                0,
                bp.getZ() - bp.getRadius());
        es.makeCuboidWalls(new CuboidRegion(pos1, pos2)
                , new SingleBlockPattern(
                new BaseBlock(bp.getBlockID(), bp.getBlockMeta())));
    }
}

@@ -322,24 +322,52 @@
 boidRegion;%0A
+import org.bukkit.Location;%0A
 import uk.co
@@ -514,16 +514,60 @@
 = 256;%0A%0A
+    /**%0A     * Make a square border%0A     */%0A
     publ
@@ -769,16 +769,95 @@
 ption %7B%0A
+        Location center = bp.getCenter();%0A        int radius = bp.getRadius();%0A
         
@@ -902,34 +902,35 @@
     
-bp.getX() + bp.getR
+center.getBlockX() + r
 adius
-()
 ,%0A  
@@ -975,34 +975,35 @@
     
-bp.getZ() + bp.getR
+center.getBlockZ() + r
 adius
-()
 );%0A 
@@ -1055,34 +1055,35 @@
     
-bp.getX() - bp.getR
+center.getBlockX() - r
 adius
-()
 ,%0A  
@@ -1119,34 +1119,35 @@
     
-bp.getZ() - bp.getR
+center.getBlockZ() - r
 adius
-()
 );%0A 
@@ -1200,33 +1200,16 @@
 1, pos2)
-%0A                
 , new Si
@@ -1225,33 +1225,16 @@
 Pattern(
-%0A                
 new Base

fix to new params