diff --git a/core/src/main/java/tc/oc/pgm/action/ActionParser.java b/core/src/main/java/tc/oc/pgm/action/ActionParser.java index e6ce0b6d5e..32bb2d3760 100644 --- a/core/src/main/java/tc/oc/pgm/action/ActionParser.java +++ b/core/src/main/java/tc/oc/pgm/action/ActionParser.java @@ -285,6 +285,7 @@ public FillAction parseFill(Element el, Class scope) throws InvalidXMLExcepti return new FillAction( regions.parseProperty(Node.fromAttrOrSelf(el, "region"), BlockBoundedValidation.INSTANCE), XMLUtils.parseMaterialData(Node.fromRequiredAttr(el, "material")), + filters.parseProperty(Node.fromAttr(el, "filter")), XMLUtils.parseBoolean(el.getAttribute("events"), false)); } } diff --git a/core/src/main/java/tc/oc/pgm/action/actions/FillAction.java b/core/src/main/java/tc/oc/pgm/action/actions/FillAction.java index 33971efbe7..11a1995715 100644 --- a/core/src/main/java/tc/oc/pgm/action/actions/FillAction.java +++ b/core/src/main/java/tc/oc/pgm/action/actions/FillAction.java @@ -4,25 +4,33 @@ import org.bukkit.block.BlockState; import org.bukkit.event.block.BlockFormEvent; import org.bukkit.material.MaterialData; +import org.jetbrains.annotations.Nullable; +import tc.oc.pgm.api.filter.Filter; import tc.oc.pgm.api.match.Match; import tc.oc.pgm.api.region.Region; +import tc.oc.pgm.filters.query.BlockQuery; public class FillAction extends AbstractAction { private final Region region; private final MaterialData materialData; + private final @Nullable Filter filter; private final boolean events; - public FillAction(Region region, MaterialData materialData, boolean events) { + public FillAction( + Region region, MaterialData materialData, @Nullable Filter filter, boolean events) { super(Match.class); this.region = region; this.materialData = materialData; + this.filter = filter; this.events = events; } @Override public void trigger(Match match) { for (Block block : region.getBlocks(match.getWorld())) { + if (filter != null && filter.query(new BlockQuery(block)).isDenied()) continue; + BlockState newState = block.getState(); newState.setMaterialData(materialData);