From 5f47ede05ad058d293b5cf3d1a27882f263d4bbf Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 2 Aug 2013 21:50:58 -0400 Subject: [PATCH] Made generation commands respect the max-radius config setting. --- .../java/com/sk89q/worldedit/WorldEdit.java | 4 ++-- .../commands/GenerationCommands.java | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/WorldEdit.java b/src/main/java/com/sk89q/worldedit/WorldEdit.java index 1b814ddaa..5c0782adb 100644 --- a/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -1458,9 +1458,9 @@ public class WorldEdit { 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) { diff --git a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java index 3e745a603..88048dbc4 100644 --- a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java @@ -86,6 +86,10 @@ public class GenerationCommands { } 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 class GenerationCommands { } 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 class GenerationCommands { 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 class GenerationCommands { 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 class GenerationCommands { 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 class GenerationCommands { 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();