package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.api.action.CastContext;
import org.bukkit.configuration.ConfigurationSection;

public class PlaneAction extends VolumeAction
{
	protected enum Axis { X, Y, Z };
	protected Axis axis;

	@Override
	public void prepare(CastContext context, ConfigurationSection parameters) {
		String axisType = parameters.getString("axis");
		if (axisType != null) {
			if (axisType.equalsIgnoreCase("x")) {
				axis = Axis.X;
			} else if (axisType.equalsIgnoreCase("z")) {
				axis = Axis.Z;
			} else {
				axis = Axis.Y;
			}
		} else {
			axis = Axis.Y;
		}
		super.prepare(context, parameters);
	}

	@Override
    protected boolean calculateSize(CastContext context) {
		switch (axis)
		{
			case X:
				xSize = 0;
				break;
			case Z:
				zSize = 0;
				break;
			default:
				ySize = 0;
				break;
		}
		return super.calculateSize(context);
	}

	@Override
    protected boolean containsPoint(int x, int y, int z)
	{
		return true;
	}
}

@@ -99,16 +99,101 @@
 ontext;%0A
+import com.elmakers.mine.bukkit.api.block.MaterialBrush;%0Aimport org.bukkit.Location;%0A
 import o
@@ -342,16 +342,43 @@
 is axis;
+%0A%09protected Axis brushAxis;
 %0A%0A%09@Over
@@ -465,55 +465,236 @@
 %7B%0A%09%09
+axis = parseAxis(parameters.get
 String
- 
+(%22
 axis
-Type = parameters.getString(%22axis%22);
+%22), Axis.Y);%0A%09%09brushAxis = parseAxis(parameters.getString(%22brush_axis%22), axis);%0A%0A%09%09super.prepare(context, parameters);%0A%09%7D%0A%0A%09protected Axis parseAxis(String axisType, Axis defaultAxis) %7B
 %0A%09%09i
@@ -757,30 +757,30 @@
 %22x%22)) %7B%0A%09%09%09%09
-axis =
+return
  Axis.X;%0A%09%09%09
@@ -824,30 +824,30 @@
 %22z%22)) %7B%0A%09%09%09%09
-axis =
+return
  Axis.Z;%0A%09%09%09
@@ -859,22 +859,22 @@
 e %7B%0A%09%09%09%09
-axis =
+return
  Axis.Y;
@@ -886,74 +886,30 @@
 %0A%09%09%7D
- else %7B%0A%09%09%09axis = Axis.Y;%0A%09%09%7D%0A%09%09super.prepare(context, parameters)
+%0A%0A%09%09return defaultAxis
 ;%0A%09%7D
@@ -1155,24 +1155,715 @@
 ntext);%0A%09%7D%0A%0A
+%09@Override%0A%09public void reset(CastContext context) %7B%0A%09%09super.reset(context);%0A%09%09MaterialBrush brush = context.getBrush();%0A%09%09Location targetLocation = context.getTargetLocation();%0A%09%09Location orientLocation = targetLocation.clone();%0A%09%09switch (brushAxis) %7B%0A%09%09%09case X:%0A%09%09%09%09orientLocation.setY(orientLocation.getY() + 1);%0A%09%09%09%09orientLocation.setZ(orientLocation.getZ() + 1);%0A%09%09%09%09break;%0A%09%09%09case Z:%0A%09%09%09%09orientLocation.setX(orientLocation.getX() + 1);%0A%09%09%09%09orientLocation.setY(orientLocation.getY() + 1);%0A%09%09%09%09break;%0A%09%09%09default:%0A%09%09%09%09orientLocation.setX(orientLocation.getX() + 1);%0A%09%09%09%09orientLocation.setZ(orientLocation.getZ() + 1);%0A%09%09%09%09break;%0A%09%09%7D%0A%09%09brush.setTarget(orientLocation, targetLocation);%0A%09%7D%0A%0A
 %09@Override%0A 

Add brush_axis parameter to Plane action, orient brush along plane of construction by default