Search in sources :

Example 1 with ExtentTraverser

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);
}
Also used : ExtentTraverser(com.fastasyncworldedit.core.util.ExtentTraverser)

Example 2 with ExtentTraverser

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);
    }
}
Also used : ExtentTraverser(com.fastasyncworldedit.core.util.ExtentTraverser) BlockTypeMask(com.sk89q.worldedit.function.mask.BlockTypeMask) SingleBlockTypeMask(com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask) RegionMask(com.sk89q.worldedit.function.mask.RegionMask) BlockStateMask(com.sk89q.worldedit.function.mask.BlockStateMask) WallMakeMask(com.fastasyncworldedit.core.function.mask.WallMakeMask) ExistingBlockMask(com.sk89q.worldedit.function.mask.ExistingBlockMask) BoundedHeightMask(com.sk89q.worldedit.function.mask.BoundedHeightMask) ResettableMask(com.fastasyncworldedit.core.function.mask.ResettableMask) Mask(com.sk89q.worldedit.function.mask.Mask) SourceMaskExtent(com.fastasyncworldedit.core.extent.SourceMaskExtent) MaskTraverser(com.fastasyncworldedit.core.util.MaskTraverser) ResettableMask(com.fastasyncworldedit.core.function.mask.ResettableMask)

Example 3 with ExtentTraverser

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");
    }
}
Also used : ForgetfulExtentBuffer(com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer) ExtentTraverser(com.fastasyncworldedit.core.util.ExtentTraverser) HistoryExtent(com.fastasyncworldedit.core.extent.HistoryExtent) NullExtent(com.fastasyncworldedit.core.extent.NullExtent) FaweException(com.fastasyncworldedit.core.internal.exception.FaweException)

Example 4 with ExtentTraverser

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;
}
Also used : ExtentTraverser(com.fastasyncworldedit.core.util.ExtentTraverser) NullExtent(com.fastasyncworldedit.core.extent.NullExtent) NullExtent(com.fastasyncworldedit.core.extent.NullExtent)

Example 5 with ExtentTraverser

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;
}
Also used : ExtentTraverser(com.fastasyncworldedit.core.util.ExtentTraverser) HistoryExtent(com.fastasyncworldedit.core.extent.HistoryExtent) NullExtent(com.fastasyncworldedit.core.extent.NullExtent) NullExtent(com.fastasyncworldedit.core.extent.NullExtent)

Aggregations

ExtentTraverser (com.fastasyncworldedit.core.util.ExtentTraverser)6 NullExtent (com.fastasyncworldedit.core.extent.NullExtent)3 HistoryExtent (com.fastasyncworldedit.core.extent.HistoryExtent)2 MaskTraverser (com.fastasyncworldedit.core.util.MaskTraverser)2 SourceMaskExtent (com.fastasyncworldedit.core.extent.SourceMaskExtent)1 ResettableMask (com.fastasyncworldedit.core.function.mask.ResettableMask)1 SingleBlockTypeMask (com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask)1 WallMakeMask (com.fastasyncworldedit.core.function.mask.WallMakeMask)1 FaweException (com.fastasyncworldedit.core.internal.exception.FaweException)1 EditSession (com.sk89q.worldedit.EditSession)1 ForgetfulExtentBuffer (com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer)1 BlockStateMask (com.sk89q.worldedit.function.mask.BlockStateMask)1 BlockTypeMask (com.sk89q.worldedit.function.mask.BlockTypeMask)1 BoundedHeightMask (com.sk89q.worldedit.function.mask.BoundedHeightMask)1 ExistingBlockMask (com.sk89q.worldedit.function.mask.ExistingBlockMask)1 Mask (com.sk89q.worldedit.function.mask.Mask)1 RegionMask (com.sk89q.worldedit.function.mask.RegionMask)1