// Special syntax (//expand vert) to expand the selection between
// sky and bedrock.
if (args.getString(0).equalsIgnoreCase("vert")
|| args.getString(0).equalsIgnoreCase("vertical")) {
Region region = session.getSelection(player.getWorld());
try {
int oldSize = region.getArea();
region.expand(
new Vector(0, (player.getWorld().getMaxY() + 1), 0),
new Vector(0, -(player.getWorld().getMaxY() + 1), 0));
session.getRegionSelector(player.getWorld()).learnChanges();
int newSize = region.getArea();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
player.print("Region expanded " + (newSize - oldSize)
+ " blocks [top-to-bottom].");
} catch (RegionOperationException e) {
player.printError(e.getMessage());
}
return;
}
List<Vector> dirs = new ArrayList<Vector>();
int change = args.getInteger(0);
int reverseChange = 0;
switch (args.argsLength()) {
case 2:
// Either a reverse amount or a direction
try {
reverseChange = args.getInteger(1);
dirs.add(we.getDirection(player, "me"));
} catch (NumberFormatException e) {
if (args.getString(1).contains(",")) {
String[] split = args.getString(1).split(",");
for (String s : split) {
dirs.add(we.getDirection(player, s.toLowerCase()));
}
} else {
dirs.add(we.getDirection(player, args.getString(1).toLowerCase()));
}
}
break;
case 3:
// Both reverse amount and direction
reverseChange = args.getInteger(1);
if (args.getString(2).contains(",")) {
String[] split = args.getString(2).split(",");
for (String s : split) {
dirs.add(we.getDirection(player, s.toLowerCase()));
}
} else {
dirs.add(we.getDirection(player, args.getString(2).toLowerCase()));
}
break;
default:
dirs.add(we.getDirection(player, "me"));
break;
}
Region region = session.getSelection(player.getWorld());
int oldSize = region.getArea();
if (reverseChange == 0) {
for (Vector dir : dirs) {
region.expand(dir.multiply(change));
}
} else {
for (Vector dir : dirs) {
region.expand(dir.multiply(change), dir.multiply(-reverseChange));
}
}
session.getRegionSelector(player.getWorld()).learnChanges();
int newSize = region.getArea();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
player.print("Region expanded " + (newSize - oldSize) + " blocks.");
}