diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java index 8a3a393e..eff2dbbf 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java @@ -81,6 +81,22 @@ public class Sniper { private ChangeSetFaweQueue changeQueue; private FaweQueue baseQueue; + public void storeUndo(Undo undo) { + ChangeSetFaweQueue tmpQueue; + synchronized (this) { + tmpQueue = changeQueue; + maskQueue = null; + baseQueue = null; + changeQueue = null; + } + if (tmpQueue != null) { + FaweChangeSet changeSet = tmpQueue.getChangeSet(); + FawePlayer fp = FawePlayer.wrap(getPlayer()); + LocalSession session = fp.getSession(); + session.remember(changeSet.toEditSession(fp)); + } + } + // Added public AsyncWorld getWorld() { synchronized (this) { @@ -382,24 +398,6 @@ public class Sniper { this.enabled = enabled; } - public void storeUndo(Undo undo) { - synchronized (this) { - if (changeQueue != null) { - FaweChangeSet changeSet = changeQueue.getChangeSet(); - FawePlayer fp = FawePlayer.wrap(getPlayer()); - LocalSession session = fp.getSession(); - session.remember(changeSet.toEditSession(fp)); - com.sk89q.worldedit.world.World worldEditWorld = fp.getWorld(); - changeSet = FaweChangeSet.getDefaultChangeSet(worldEditWorld, fp.getUUID()); - changeQueue.setChangeSet(changeSet); - // NEW QUEUE? - maskQueue = null; - baseQueue = null; - changeQueue = null; - } - } - } - public void undo() { undo(1); }