Made generation commands respect the max-radius config setting.

Dieser Commit ist enthalten in:
wizjany 2013-08-02 21:50:58 -04:00
Ursprung d7324f6b13
Commit 5f47ede05a
2 geänderte Dateien mit 24 neuen und 2 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -86,6 +86,10 @@ public class GenerationCommands {
} }
int height = args.argsLength() > 2 ? args.getInteger(2) : 1; int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusZ);
we.checkMaxRadius(height);
Vector pos = session.getPlacementPosition(player); Vector pos = session.getPlacementPosition(player);
int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, false); int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, false);
player.print(affected + " block(s) have been created."); player.print(affected + " block(s) have been created.");
@ -127,6 +131,10 @@ public class GenerationCommands {
} }
int height = args.argsLength() > 2 ? args.getInteger(2) : 1; int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusZ);
we.checkMaxRadius(height);
Vector pos = session.getPlacementPosition(player); Vector pos = session.getPlacementPosition(player);
int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, true); int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, true);
player.print(affected + " block(s) have been created."); 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."); player.printError("You must either specify 1 or 3 radius values.");
return; return;
} }
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusY);
we.checkMaxRadius(radiusZ);
final boolean raised; final boolean raised;
if (args.argsLength() > 2) { if (args.argsLength() > 2) {
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes"); 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."); player.printError("You must either specify 1 or 3 radius values.");
return; return;
} }
we.checkMaxRadius(radiusX);
we.checkMaxRadius(radiusY);
we.checkMaxRadius(radiusZ);
final boolean raised; final boolean raised;
if (args.argsLength() > 2) { if (args.argsLength() > 2) {
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes"); 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)); int size = Math.max(1, args.getInteger(1));
Vector pos = session.getPlacementPosition(player); Vector pos = session.getPlacementPosition(player);
we.checkMaxRadius(size);
int affected = editSession.makePyramid(pos, block, size, true); int affected = editSession.makePyramid(pos, block, size, true);
player.findFreePosition(); player.findFreePosition();
@ -321,6 +341,8 @@ public class GenerationCommands {
int size = Math.max(1, args.getInteger(1)); int size = Math.max(1, args.getInteger(1));
Vector pos = session.getPlacementPosition(player); Vector pos = session.getPlacementPosition(player);
we.checkMaxRadius(size);
int affected = editSession.makePyramid(pos, block, size, false); int affected = editSession.makePyramid(pos, block, size, false);
player.findFreePosition(); player.findFreePosition();