/** * Closing an EditSession {@linkplain #flushSession() flushes its buffers}. */ @Override public void close() { flushSession(); }
/** * Disable the queue. This will {@linkplain #flushSession() flush the session}. * * @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with another mode instead. */ @Deprecated public void disableQueue() { if (isQueueEnabled()) { flushSession(); } setReorderMode(ReorderMode.NONE); }
/** * Enable or disable chunk batching. Disabling will * {@linkplain #flushSession() flush the session}. * * @param batchingChunks {@code true} to enable, {@code false} to disable */ public void setBatchingChunks(boolean batchingChunks) { if (chunkBatchingExtent == null) { if (batchingChunks) { throw new UnsupportedOperationException("Chunk batching not supported by this session."); } return; } if (!batchingChunks && isBatchingChunks()) { flushSession(); } chunkBatchingExtent.setEnabled(batchingChunks); }
/** * Disable all buffering extents. * * @see #setReorderMode(ReorderMode) * @see #setBatchingChunks(boolean) */ public void disableBuffering() { // We optimize here to avoid repeated calls to flushSession. if (commitRequired()) { flushSession(); } setReorderMode(ReorderMode.NONE); if (chunkBatchingExtent != null) { chunkBatchingExtent.setEnabled(false); } }
/** * Sets to new state. * * @param editSession a new {@link EditSession} to perform the redo in */ public void redo(EditSession editSession) { UndoContext context = new UndoContext(); context.setExtent(editSession.bypassHistory); Operations.completeBlindly(ChangeSetExecutor.createRedo(changeSet, context)); editSession.flushSession(); }
/** * Restores all blocks to their initial state. * * @param editSession a new {@link EditSession} to perform the undo in */ public void undo(EditSession editSession) { UndoContext context = new UndoContext(); context.setExtent(editSession.bypassHistory); Operations.completeBlindly(ChangeSetExecutor.createUndo(changeSet, context)); editSession.flushSession(); }
} finally { for (EditSession editSession : scriptContext.getEditSessions()) { editSession.flushSession(); session.remember(editSession);
/** * Remember an edit session. * * @param player a player * @param editSession an edit session */ public void remember(Player player, EditSession editSession) { com.sk89q.worldedit.entity.Player wePlayer = wrapPlayer(player); LocalSession session = WorldEdit.getInstance().getSessionManager().get(wePlayer); session.remember(editSession); editSession.flushSession(); WorldEdit.getInstance().flushBlockBag(wePlayer, editSession); }
editSession.flushSession();
editSession.flushSession();
editSession.flushSession();