use of com.fastasyncworldedit.core.util.ExtentTraverser in project FastAsyncWorldEdit by IntellectualSites.
the class EditSession method addTransform.
public void addTransform(ResettableExtent transform) {
checkNotNull(transform);
transform.setExtent(getExtent());
new ExtentTraverser(this).setNext(transform);
}
use of com.fastasyncworldedit.core.util.ExtentTraverser 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);
}
}
use of com.fastasyncworldedit.core.util.ExtentTraverser in project FastAsyncWorldEdit by IntellectualSites.
the class AbstractDelegateExtent method disableQueue.
@Override
public void disableQueue() {
try {
if (!(extent instanceof ForgetfulExtentBuffer)) {
// placeholder
extent.disableQueue();
}
} catch (FaweException ignored) {
}
if (extent instanceof AbstractDelegateExtent) {
Extent next = ((AbstractDelegateExtent) extent).getExtent();
new ExtentTraverser(this).setNext(next);
} else {
LOGGER.error("Cannot disable queue");
}
}
use of com.fastasyncworldedit.core.util.ExtentTraverser in project FastAsyncWorldEdit by IntellectualSites.
the class Extent method cancel.
default boolean cancel() {
ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this);
NullExtent nullExtent = new NullExtent(this, FaweCache.MANUAL);
ExtentTraverser<Extent> next = traverser.next();
if (next != null) {
Extent child = next.get();
if (child instanceof NullExtent) {
return true;
}
traverser.setNext(nullExtent);
child.cancel();
}
addProcessor(nullExtent);
addPostProcessor(nullExtent);
return true;
}
use of com.fastasyncworldedit.core.util.ExtentTraverser in project FastAsyncWorldEdit by IntellectualSites.
the class AbstractDelegateExtent method cancel.
@Override
public boolean cancel() {
ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this);
NullExtent nullExtent = new NullExtent(getExtent(), FaweCache.MANUAL);
ExtentTraverser<Extent> next = traverser.next();
if (next != null) {
Extent child = next.get();
if (child instanceof NullExtent) {
return true;
}
traverser.setNext(nullExtent);
child.cancel();
}
addProcessor(nullExtent);
addPostProcessor(nullExtent);
return true;
}
Aggregations