use of com.sk89q.worldedit.history.UndoContext in project FastAsyncWorldEdit by IntellectualSites.
the class EditSession method undo.
// FAWE end
// FAWE start
/**
* 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();
// FAWE start - listen for inventory, flush & prepare changeset
context.setExtent(editSession.bypassAll);
ChangeSet changeSet = getChangeSet();
setChangeSet(null);
Operations.completeBlindly(ChangeSetExecutor.create(changeSet, context, ChangeSetExecutor.Type.UNDO, editSession.getBlockBag(), editSession.getLimit().INVENTORY_MODE));
flushQueue();
editSession.changes = 1;
}
use of com.sk89q.worldedit.history.UndoContext in project FastAsyncWorldEdit by IntellectualSites.
the class EditSession method redo.
// FAWE end
/**
* Sets to new state.
*
* @param editSession a new {@link EditSession} to perform the redo in
*/
public void redo(EditSession editSession) {
UndoContext context = new UndoContext();
// FAWE start - listen for inventory, flush & prepare changeset
context.setExtent(editSession.bypassAll);
ChangeSet changeSet = getChangeSet();
setChangeSet(null);
Operations.completeBlindly(ChangeSetExecutor.create(changeSet, context, ChangeSetExecutor.Type.REDO, editSession.getBlockBag(), editSession.getLimit().INVENTORY_MODE));
flushQueue();
editSession.changes = 1;
}
use of com.sk89q.worldedit.history.UndoContext in project FastAsyncWorldEdit by IntellectualSites.
the class EditSession method setBlocks.
// FAWE start
public void setBlocks(ChangeSet changeSet, ChangeSetExecutor.Type type) {
final UndoContext context = new UndoContext();
context.setExtent(bypassAll);
Operations.completeBlindly(ChangeSetExecutor.create(changeSet, context, type, getBlockBag(), getLimit().INVENTORY_MODE));
flushQueue();
changes = 1;
}
Aggregations