Discard unused EditSession when using /u

This commit is contained in:
Jesse Boyd 2018-01-15 23:21:11 +11:00
parent 2448b2fe22
commit bcb9320a45
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -25,6 +25,7 @@ import com.google.common.collect.ClassToInstanceMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.MutableClassToInstanceMap; import com.google.common.collect.MutableClassToInstanceMap;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.extent.MaskingExtent; import com.sk89q.worldedit.extent.MaskingExtent;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
@ -465,8 +466,11 @@ public class Sniper {
public void run() { public void run() {
int count = 0; int count = 0;
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
if (fp.getSession().undo(null, fp.getPlayer()) == null) { EditSession es = fp.getSession().undo(null, fp.getPlayer());
if (es == null) {
break; break;
} else {
es.flushQueue();
} }
count++; count++;
} }