From e13d5198be70b1e97625084fed6e386630e511d0 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 29 Mar 2014 18:31:34 -0700 Subject: [PATCH] Added a BlockMask(BaseBlock... block) constructor. --- .../com/sk89q/worldedit/masks/BlockMask.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/masks/BlockMask.java b/src/main/java/com/sk89q/worldedit/masks/BlockMask.java index e852a9990..ee52d511a 100644 --- a/src/main/java/com/sk89q/worldedit/masks/BlockMask.java +++ b/src/main/java/com/sk89q/worldedit/masks/BlockMask.java @@ -1,14 +1,15 @@ package com.sk89q.worldedit.masks; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + public class BlockMask extends AbstractMask { + private final Set blocks; public BlockMask() { @@ -19,6 +20,13 @@ public class BlockMask extends AbstractMask { this.blocks = types; } + public BlockMask(BaseBlock... block) { + blocks = new HashSet(); + for (BaseBlock b : block) { + add(b); + } + } + public BlockMask(BaseBlock block) { this(); add(block); @@ -35,7 +43,8 @@ public class BlockMask extends AbstractMask { @Override public boolean matches(EditSession editSession, Vector pos) { BaseBlock block = editSession.getBlock(pos); - return blocks.contains(block) + return blocks.contains(block) || blocks.contains(new BaseBlock(block.getType(), -1)); - } + } + }