use of com.fastasyncworldedit.core.extent.SourceMaskExtent in project FastAsyncWorldEdit by IntellectualSites.
the class EditSession method setSourceMask.
// FAWE end
// FAWE start - use source mast > mask
/**
* Set a mask.
*
* @param mask mask or null
*/
public void setSourceMask(Mask mask) {
if (mask == null) {
mask = Masks.alwaysTrue();
} else {
new MaskTraverser(mask).reset(this);
}
ExtentTraverser<SourceMaskExtent> maskingExtent = new ExtentTraverser<>(getExtent()).find(SourceMaskExtent.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()) {
SourceMaskExtent next = new SourceMaskExtent(getExtent(), mask);
new ExtentTraverser(this).setNext(next);
}
}
Aggregations