Fixes #232 dont allow negative brush radius

This commit is contained in:
Jesse Boyd 2019-11-24 01:30:19 +00:00
parent cbeaa1a7a0
commit 4f34d1b5d1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit;
import static com.google.common.base.Preconditions.checkArgument;
import static com.sk89q.worldedit.event.platform.Interaction.HIT;
import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
@ -408,8 +409,9 @@ public final class WorldEdit {
}
public void checkMaxBrushRadius(Expression radius) throws MaxBrushRadiusException {
double val = radius.evaluate();
checkArgument(val >= 0);
if (getConfiguration().maxBrushRadius > 0) {
double val = radius.evaluate();
if (val > getConfiguration().maxBrushRadius) {
throw new MaxBrushRadiusException();
}