Made generation commands respect the max-radius config setting.

This commit is contained in:
wizjany 2013-08-02 21:50:58 -04:00
parent d7324f6b13
commit 5f47ede05a
2 changed files with 24 additions and 2 deletions

View File

@ -1458,9 +1458,9 @@ public boolean handleCommand(LocalPlayer player, String[] split) {
player.printError("Max blocks changed in an operation reached ("
+ e.getBlockLimit() + ").");
} catch (MaxBrushRadiusException e) {
player.printError("Maximum allowed brush radius/height: " + config.maxBrushRadius);
player.printError("Maximum allowed brush size: " + config.maxBrushRadius);
} catch (MaxRadiusException e) {
player.printError("Maximum radius: " + config.maxRadius);
player.printError("Maximum allowed size: " + config.maxRadius);
} catch (UnknownDirectionException e) {
player.printError("Unknown direction: " + e.getDirection());
} catch (InsufficientArgumentsException e) {

View File

@ -86,6 +86,10 @@ public void hcyl(CommandContext args, LocalSession session, LocalPlayer player,
}
int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusZ);
we.checkMaxRadius(height);
Vector pos = session.getPlacementPosition(player);
int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, false);
player.print(affected + " block(s) have been created.");
@ -127,6 +131,10 @@ public void cyl(CommandContext args, LocalSession session, LocalPlayer player,
}
int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusZ);
we.checkMaxRadius(height);
Vector pos = session.getPlacementPosition(player);
int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, true);
player.print(affected + " block(s) have been created.");
@ -167,6 +175,11 @@ public void hsphere(CommandContext args, LocalSession session, LocalPlayer playe
player.printError("You must either specify 1 or 3 radius values.");
return;
}
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusY);
we.checkMaxRadius(radiusZ);
final boolean raised;
if (args.argsLength() > 2) {
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes");
@ -219,6 +232,11 @@ public void sphere(CommandContext args, LocalSession session, LocalPlayer player
player.printError("You must either specify 1 or 3 radius values.");
return;
}
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusY);
we.checkMaxRadius(radiusZ);
final boolean raised;
if (args.argsLength() > 2) {
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes");
@ -299,6 +317,8 @@ public void pyramid(CommandContext args, LocalSession session, LocalPlayer playe
int size = Math.max(1, args.getInteger(1));
Vector pos = session.getPlacementPosition(player);
we.checkMaxRadius(size);
int affected = editSession.makePyramid(pos, block, size, true);
player.findFreePosition();
@ -321,6 +341,8 @@ public void hpyramid(CommandContext args, LocalSession session, LocalPlayer play
int size = Math.max(1, args.getInteger(1));
Vector pos = session.getPlacementPosition(player);
we.checkMaxRadius(size);
int affected = editSession.makePyramid(pos, block, size, false);
player.findFreePosition();