3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

Changes to EditSession to improve upstream compatibility

Dieser Commit ist enthalten in:
IronApollo 2019-02-27 09:01:07 -05:00
Ursprung 3ffb5ff00d
Commit 0fa9d7a4a7

Datei anzeigen

@ -149,7 +149,7 @@ import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
* {@link Extent}s that are chained together. For example, history is logged * {@link Extent}s that are chained together. For example, history is logged
* using the {@link ChangeSetExtent}.</p> * using the {@link ChangeSetExtent}.</p>
*/ */
public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, SimpleWorld { public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, SimpleWorld, AutoCloseable {
/** /**
* Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to * Used by {@link EditSession#setBlock(BlockVector3, BlockStateHolder, Stage)} to
* determine which {@link Extent}s should be bypassed. * determine which {@link Extent}s should be bypassed.
@ -1263,6 +1263,27 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
return this.extent.getEntities(); return this.extent.getEntities();
} }
/**
* Closing an EditSession {@linkplain #flushSession() flushes its buffers}.
*/
@Override
public void close() {
flushSession();
}
/**
* Communicate to the EditSession that all block changes are complete,
* and that it should apply them to the world.
*/
public void flushSession() {
Operations.completeBlindly(commit());
}
@Override
public @Nullable Operation commit() {
return extent.commit();
}
/** /**
* Finish off the queue. * Finish off the queue.
*/ */