Skip to content
Permalink
Browse files

Add missing radius checks.

Courtesy @mathiascode.
  • Loading branch information...
wizjany committed Aug 5, 2019
1 parent 8880385 commit 6ab74dc7e5b1cc96722fa29fe20135fdf08b680e
@@ -205,6 +205,7 @@ public int forestGen(Player player, LocalSession session, EditSession editSessio
@Arg(desc = "The density of the forest, between 0 and 100", def = "5")
double density) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100");
worldEdit.checkMaxRadius(size);
density /= 100;
int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type);
player.print(affected + " trees created.");
@@ -220,6 +221,7 @@ public int forestGen(Player player, LocalSession session, EditSession editSessio
public int pumpkins(Player player, LocalSession session, EditSession editSession,
@Arg(desc = "The size of the patch", def = "10")
int size) throws WorldEditException {
worldEdit.checkMaxRadius(size);
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), size);
player.print(affected + " pumpkin patches created.");
return affected;
@@ -252,8 +254,8 @@ public int pyramid(Player player, LocalSession session, EditSession editSession,
int size,
@Switch(name = 'h', desc = "Make a hollow pyramid")
boolean hollow) throws WorldEditException {
BlockVector3 pos = session.getPlacementPosition(player);
worldEdit.checkMaxRadius(size);
BlockVector3 pos = session.getPlacementPosition(player);
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
player.findFreePosition();
player.print(affected + " block(s) have been created.");

0 comments on commit 6ab74dc

Please sign in to comment.
You can’t perform that action at this time.