Made a checkMaxBrushRadius method for centralized use.

This commit is contained in:
wizjany
2013-08-02 21:33:11 -04:00
parent bc39a913ea
commit d7324f6b13
4 changed files with 35 additions and 43 deletions

View File

@ -917,6 +917,18 @@ public class WorldEdit {
}
}
/**
* Checks to see if the specified brush radius is within bounds.
*
* @param radius
* @throws MaxBrushRadiusException
*/
public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException {
if (config.maxBrushRadius > 0 && radius > config.maxBrushRadius) {
throw new MaxBrushRadiusException();
}
}
/**
* Get a file relative to the defined working directory. If the specified
* path is absolute, then the working directory is not used.
@ -1445,6 +1457,8 @@ public class WorldEdit {
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks changed in an operation reached ("
+ e.getBlockLimit() + ").");
} catch (MaxBrushRadiusException e) {
player.printError("Maximum allowed brush radius/height: " + config.maxBrushRadius);
} catch (MaxRadiusException e) {
player.printError("Maximum radius: " + config.maxRadius);
} catch (UnknownDirectionException e) {