use of com.sk89q.worldedit.extent.MaskingExtent in project FastAsyncWorldEdit by IntellectualSites.
the class EditSession method setMask.
// FAWE end
// FAWE start - use MaskingExtent & ExtentTraverser
/**
* Set a mask.
*
* @param mask mask or null
*/
public void setMask(Mask mask) {
if (mask == null) {
mask = Masks.alwaysTrue();
} else {
new MaskTraverser(mask).reset(this);
}
ExtentTraverser<MaskingExtent> maskingExtent = new ExtentTraverser<>(getExtent()).find(MaskingExtent.class);
if (maskingExtent != null && maskingExtent.get() != null) {
Mask oldMask = maskingExtent.get().getMask();
if (oldMask instanceof ResettableMask) {
((ResettableMask) oldMask).reset();
}
maskingExtent.get().setMask(mask);
} else if (mask != Masks.alwaysTrue()) {
addProcessor(new MaskingExtent(getExtent(), mask));
}
}
Aggregations