Class AbstractChangeSet
java.lang.Object
com.fastasyncworldedit.core.history.changeset.AbstractChangeSet
- All Implemented Interfaces:
IBatchProcessor
,ChangeSet
,Closeable
,AutoCloseable
- Direct Known Subclasses:
AbstractDelegateChangeSet
,FaweStreamChangeSet
,NullChangeSet
This batch processor writes changes to a concrete implementation.
processSet(IChunk, IChunkGet, IChunkSet)
is synchronized to guarantee consistency.
To avoid many blocking threads on this method, changes are enqueued in queue
.
This allows to keep other threads free for other work.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
add
(int x, int y, int z, int combinedFrom, int combinedTo) void
void
void
add
(BlockChange change) void
Add the given change to the history.void
add
(EntityCreate change) void
add
(EntityRemove change) void
add
(BlockVector3 loc, BaseBlock from, BaseBlock to) abstract void
addBiomeChange
(int x, int y, int z, BiomeType from, BiomeType to) abstract void
Creates an entity create change to this change set.void
Deprecated, for removal: This API element is subject to removal in a future version.abstract void
Creates an entity remove change to this change set.void
Deprecated, for removal: This API element is subject to removal in a future version.abstract void
Creates a tile/block entity create change to this change set.void
addTileCreate
(CompoundTag tag) Deprecated, for removal: This API element is subject to removal in a future version.abstract void
Creates a tile/block entity remove change to this change set.void
addTileRemove
(CompoundTag tag) Deprecated, for removal: This API element is subject to removal in a future version.Future
<?> addWriteTask
(Runnable writeTask) Future
<?> addWriteTask
(Runnable writeTask, boolean completeNow) Get a backward directed iterator that can be used for undo.void
close()
Close the changeset.void
Convert this processor into an Extent based processor instead of a queue batch based on.void
flush()
Get a forward directed iterator that can be used for redo.abstract ChangeExchangeCoordinator
getCoordinatedChanges
(BlockBag blockBag, int mode, boolean dir) Returns a coordinator to exchange sets of changes between a producer and a consumer.getIterator
(boolean redo) getIterator
(BlockBag blockBag, int mode, boolean redo) getScope()
Default to CUSTOM ProcessorScope as we want custom processors people add to be before we write history, but after FAWE does it's own stuff.getWorld()
boolean
isEmpty()
Get if the changeset is empty (i.e.void
postProcess
(IChunk chunk, IChunkGet get, IChunkSet set) Post-process a chunk that has been edited.Future
<?> postProcessSet
(IChunk chunk, IChunkGet get, IChunkSet set) Post-process a chunk that has been edited.final IChunkSet
processSet
(IChunk chunk, IChunkGet get, IChunkSet set) Process a chunk that has been set.toEditSession
(Actor actor) toEditSession
(Actor actor, Region[] regions) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.history.changeset.ChangeSet
delete, isRecordingChanges, longSize, setRecordChanges, size, summarize
Methods inherited from interface com.fastasyncworldedit.core.queue.IBatchProcessor
join, joinPost, processGet, remove, trimNBT, trimNBT, trimY
-
Field Details
-
closed
protected volatile boolean closed
-
-
Constructor Details
-
AbstractChangeSet
-
-
Method Details
-
getWorld
-
closeAsync
public void closeAsync() -
flush
public void flush()- Specified by:
flush
in interfaceIBatchProcessor
-
close
Description copied from interface:ChangeSet
Close the changeset.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChangeSet
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
add
public abstract void add(int x, int y, int z, int combinedFrom, int combinedTo) -
backwardIterator
Description copied from interface:ChangeSet
Get a backward directed iterator that can be used for undo.The iterator may return the changes out of order, as long as the final result after all changes have been applied is correct.
- Specified by:
backwardIterator
in interfaceChangeSet
- Returns:
- a undo directed iterator
-
forwardIterator
Description copied from interface:ChangeSet
Get a forward directed iterator that can be used for redo.The iterator may return the changes out of order, as long as the final result after all changes have been applied is correct.
- Specified by:
forwardIterator
in interfaceChangeSet
- Returns:
- a forward directed iterator
-
construct
Description copied from interface:IBatchProcessor
Convert this processor into an Extent based processor instead of a queue batch based on.- Specified by:
construct
in interfaceIBatchProcessor
-
processSet
Description copied from interface:IBatchProcessor
Process a chunk that has been set.- Specified by:
processSet
in interfaceIBatchProcessor
-
postProcess
Description copied from interface:IBatchProcessor
Post-process a chunk that has been edited. Set should NOT be modified here, changes will NOT be flushed to the world, but MAY be flushed to history. Defaults to nothing as most Processors will not use it. If the post-processor will run tasks asynchronously/not be blocking, useIBatchProcessor.postProcessSet(com.fastasyncworldedit.core.queue.IChunk, com.fastasyncworldedit.core.queue.IChunkGet, com.fastasyncworldedit.core.queue.IChunkSet)
to return a Future.- Specified by:
postProcess
in interfaceIBatchProcessor
-
postProcessSet
Description copied from interface:IBatchProcessor
Post-process a chunk that has been edited. Set should NOT be modified here, changes will NOT be flushed to the world, but MAY be flushed to history. Defaults to nothing as most Processors will not use it. Post-processors that are not technically blocking should override this method to allow post-processors to become blocking if required.- Specified by:
postProcessSet
in interfaceIBatchProcessor
-
getScope
Description copied from interface:IBatchProcessor
Default to CUSTOM ProcessorScope as we want custom processors people add to be before we write history, but after FAWE does it's own stuff.- Specified by:
getScope
in interfaceIBatchProcessor
-
addTileCreate
Deprecated, for removal: This API element is subject to removal in a future version. -
addTileCreate
Creates a tile/block entity create change to this change set.- Parameters:
tag
- the tile/block entity to add.- Since:
- 2.11.2
-
addTileRemove
Deprecated, for removal: This API element is subject to removal in a future version. -
addTileRemove
Creates a tile/block entity remove change to this change set.- Parameters:
tag
- the tile/block entity to remove.- Since:
- 2.11.2
-
addEntityRemove
Deprecated, for removal: This API element is subject to removal in a future version. -
addEntityRemove
Creates an entity remove change to this change set.- Parameters:
tag
- the entity to remove.- Since:
- 2.11.2
-
addEntityCreate
Deprecated, for removal: This API element is subject to removal in a future version. -
addEntityCreate
Creates an entity create change to this change set.- Parameters:
tag
- the entity to add.- Since:
- 2.11.2
-
addBiomeChange
-
getIterator
-
getCoordinatedChanges
@Internal public abstract ChangeExchangeCoordinator getCoordinatedChanges(BlockBag blockBag, int mode, boolean dir) Returns a coordinator to exchange sets of changes between a producer and a consumer.- Returns:
- a coordinator to exchange sets of changes between a producer and a consumer
- Since:
- 2.11.2
-
getIterator
-
toEditSession
-
toEditSession
-
add
-
add
-
add
Description copied from interface:ChangeSet
Add the given change to the history. -
add
-
isEmpty
public boolean isEmpty()Description copied from interface:ChangeSet
Get if the changeset is empty (i.e. size == 0) -
add
-
add
-
add
-
addWriteTask
-
addWriteTask
-