mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
Allow "post processing" of chunks (#658)
* begin allowing "post processing" of chunks - restores legacy capability to continue saving edits in the background after sending the chunks - speeds up the edit clientside - nail in the coffin of the terrible and staticly coded coreedit - We should totally make IronGolem work so Core* is no longer used by anyone * begin allowing background history saving * Handle post processors in queues properly * Use futures for postprocessing so we're not waiting for them needlessly * better use of closed boolean * Reword
This commit is contained in:
@ -317,6 +317,24 @@ public class AbstractDelegateExtent implements Extent {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent addPostProcessor(IBatchProcessor processor) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
logger.info("addPostProcessor Info: \t " + processor.getClass().getName());
|
||||
logger.info("The following is not an error or a crash:");
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
for (StackTraceElement stackTraceElement : stackTrace) {
|
||||
logger.info(stackTraceElement.toString());
|
||||
}
|
||||
|
||||
}
|
||||
Extent result = this.extent.addPostProcessor(processor);
|
||||
if (result != this.extent) {
|
||||
new ExtentTraverser<Extent>(this).setNext(result);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
Extent result = this.extent.disableHistory();
|
||||
|
@ -23,6 +23,7 @@ import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ExtentFilterBlock;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
@ -671,8 +672,16 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
return processor.construct(this);
|
||||
}
|
||||
|
||||
default Extent addPostProcessor(IBatchProcessor processor) {
|
||||
return processor.construct(this);
|
||||
}
|
||||
|
||||
default Extent enableHistory(AbstractChangeSet changeSet) {
|
||||
return addProcessor(changeSet);
|
||||
if (Settings.IMP.EXPERIMENTAL.SEND_BEFORE_HISTORY) {
|
||||
return addPostProcessor(changeSet);
|
||||
} else {
|
||||
return addProcessor(changeSet);
|
||||
}
|
||||
}
|
||||
|
||||
default Extent disableHistory() {
|
||||
|
@ -36,6 +36,9 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
@ -106,6 +109,12 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce
|
||||
return filter.filter(chunk, get, set, MaskingExtent.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<IChunkSet> postProcessSet(IChunk chunk, IChunkGet get, IChunkSet set) {
|
||||
// This should not do anything otherwise dangerous...
|
||||
return CompletableFuture.completedFuture(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBlock(final FilterBlock block) {
|
||||
if (!this.mask.test(block)) {
|
||||
|
Reference in New Issue
Block a user