Don't set extent to self when cancelling in AbstractDelegateExtent

#749
Dieser Commit ist enthalten in:
dordsor21 2021-09-02 17:13:38 +01:00
Ursprung 93dff36ee2
Commit f8aaf0cae3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
3 geänderte Dateien mit 33 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -222,6 +222,16 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
throw reason;
}
@Override
public Extent addProcessor(final IBatchProcessor processor) {
return null;
}
@Override
public Extent addPostProcessor(final IBatchProcessor processor) {
return null;
}
@Override
public BlockArrayClipboard lazyCopy(Region region) {
throw reason;

Datei anzeigen

@ -19,8 +19,10 @@
package com.sk89q.worldedit.extent;
import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.extent.HistoryExtent;
import com.fastasyncworldedit.core.extent.NullExtent;
import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet;
import com.fastasyncworldedit.core.internal.exception.FaweException;
import com.fastasyncworldedit.core.queue.IBatchProcessor;
@ -41,7 +43,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Range;
import javax.annotation.Nullable;
import java.util.List;
@ -160,6 +161,26 @@ public class AbstractDelegateExtent implements Extent {
}
}
@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;
}
//FAWE start
@Override
public void removeEntity(int x, int y, int z, UUID uuid) {

Datei anzeigen

@ -646,6 +646,7 @@ public interface Extent extends InputExtent, OutputExtent {
child.cancel();
}
addProcessor(nullExtent);
addPostProcessor(nullExtent);
return true;
}