From 16e89c23f594441f3c62c48b6ef9c312b17850bc Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 3 Apr 2014 20:09:01 -0700 Subject: [PATCH] Added sanity check to DataValidatorExtent. --- .../extent/validation/DataValidatorExtent.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java b/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java index 91e9b9daa..383e54574 100644 --- a/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java @@ -60,10 +60,16 @@ public class DataValidatorExtent extends AbstractDelegateExtent { return false; } - if (type == 0) { - block.setData(0); + if (block.getData() < 0) { + throw new SevereValidationException("Cannot set a data value that is less than 0"); } return super.setBlock(location, block); } + + private static class SevereValidationException extends WorldEditException { + private SevereValidationException(String message) { + super(message); + } + } }