Use right config value for butcher radius. Add max radius for butcher.

This commit is contained in:
Wizjany
2012-11-23 20:10:38 -05:00
parent aadfc30fbb
commit 56d534bf0d
4 changed files with 27 additions and 19 deletions

View File

@ -378,13 +378,18 @@ public class UtilityCommands {
LocalConfiguration config = we.getConfiguration();
// technically the default can be larger than the max, but that's not my problem
int radius = config.butcherDefaultRadius;
if (args.argsLength() > 0) {
if (args.getString(0).equals("all")) {
radius = -1;
} else {
radius = Math.max(1, args.getInteger(0));
// there might be a better way to do this but my brain is fried right now
if (args.argsLength() > 0) { // user inputted radius, override the default
radius = args.getInteger(0);
if (config.butcherMaxRadius != -1) { // clamp if there is a max
if (radius == -1) {
radius = config.butcherMaxRadius;
} else { // Math.min does not work if radius is -1 (actually highest possible value)
radius = Math.min(radius, config.butcherMaxRadius);
}
}
}