Permalink
Browse files

Minor cleanup of diff

  • Loading branch information...
me4502 committed Aug 29, 2018
1 parent 8476a0d commit aba6c819300bfbda964c9acbf4530c0acca90bff
@@ -283,8 +283,9 @@ public void remember(Player player, EditSession editSession) {
com.sk89q.worldedit.entity.Player wePlayer = wrapPlayer(player);
LocalSession session = WorldEdit.getInstance().getSessionManager().get(wePlayer);
editSession.flushQueue(wePlayer);
session.remember(editSession);
editSession.flushQueue(wePlayer);
WorldEdit.getInstance().flushBlockBag(wePlayer, editSession);
}
@@ -539,7 +539,11 @@ public Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntit
public Task<EditSession> undo(@Nullable Actor actor, EditSession editSession) {
UndoContext context = new UndoContext();
context.setExtent(editSession.bypassHistory);
return Operations.<EditSession>completeQueued(ChangeSetExecutor.createUndo(changeSet, context), actor, editSession).withSupplier(() -> editSession);
Task<EditSession> task = Operations.<EditSession>completeQueued(ChangeSetExecutor.createUndo(changeSet, context), actor, editSession).withSupplier(() -> editSession);
if (actor != null) {
task.addActorConsumers(actor);
}
return task;
}
/**
@@ -552,7 +556,11 @@ public Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntit
public Task<EditSession> redo(@Nullable Actor actor, EditSession editSession) {
UndoContext context = new UndoContext();
context.setExtent(editSession.bypassHistory);
return Operations.<EditSession>completeQueued(ChangeSetExecutor.createRedo(changeSet, context), actor, editSession).withSupplier(() -> editSession);
Task<EditSession> task = Operations.<EditSession>completeQueued(ChangeSetExecutor.createRedo(changeSet, context), actor, editSession).withSupplier(() -> editSession);
if (actor != null) {
task.addActorConsumers(actor);
}
return task;
}
/**
@@ -587,9 +595,12 @@ public Vector getMaximumPoint() {
/**
* Finish off the queue.
*/
public Task<Void> flushQueue(Actor actor) {
Task<Void> task = new Task<>(commit());
public Task<EditSession> flushQueue(Actor actor) {
Task<EditSession> task = new Task<EditSession>(commit()).withSupplier(() -> this);
WorldEdit.getInstance().getTaskManager().getTaskQueue(actor).offerNext(task);
if (actor != null) {
task.addActorConsumers(actor);
}
return task;
}
@@ -229,9 +229,7 @@ public void remember(EditSession editSession) {
.getEditSession(editSession.getWorld(), -1, newBlockBag, player);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
Task<EditSession> task = editSession.undo(player, newEditSession);
task.addActorConsumers(player);
return task;
return editSession.undo(player, newEditSession);
} else {
historyPointer = 0;
return null;
@@ -254,7 +252,6 @@ public void remember(EditSession editSession) {
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
Task<EditSession> task = editSession.redo(player, newEditSession);
task.addActorConsumers(player);
++historyPointer;
return task;
}

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -25,7 +25,6 @@
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.AffectingOperation;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.RunContext;
@@ -48,7 +47,7 @@
* functionality that starts at certain points and extends outward from
* those points.</p>
*/
public abstract class BreadthFirstSearch implements AffectingOperation {
public abstract class BreadthFirstSearch implements Operation {
private final RegionFunction function;
private final Queue<BlockVector> queue = new ArrayDeque<>();
@@ -153,6 +152,11 @@ private void visit(Vector from, Vector to) {
*/
protected abstract boolean isVisitable(Vector from, Vector to);
/**
* Get the number of affected objects.
*
* @return the number of affected
*/
public int getAffected() {
return affected;
}

0 comments on commit aba6c81

Please sign in to comment.