From 6f3016c7f01fb4786a2ce1d3c41718e1b5b17298 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 9 Dec 2018 15:15:34 +1000 Subject: [PATCH] Fixed up the commitRequired checks. --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 ++ .../sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java | 4 ++-- .../com/sk89q/worldedit/extent/reorder/MultiStageReorder.java | 4 ++-- .../java/com/sk89q/worldedit/extent/world/FastModeExtent.java | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index b7e2753a3..4d1bde24d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -386,7 +386,9 @@ public class EditSession implements Extent, AutoCloseable { * Returns queue status. * * @return whether the queue is enabled + * @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead. */ + @Deprecated public boolean isQueueEnabled() { return reorderMode == ReorderMode.MULTI_STAGE && reorderExtent.isEnabled(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java index 4379a0550..daeb9f0e6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java @@ -73,7 +73,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { } public boolean commitRequired() { - return enabled && batches.size() > 0; + return enabled; } @Override @@ -88,7 +88,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent { @Override protected Operation commitBefore() { - if (!enabled) { + if (!commitRequired()) { return null; } return new Operation() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index f58161b7c..aa1694740 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -199,7 +199,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } public boolean commitRequired() { - return enabled && stages.values().stream().anyMatch(stage -> stage.size() > 0); + return enabled; } /** @@ -248,7 +248,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder @Override public Operation commitBefore() { - if (!enabled) { + if (!commitRequired()) { return null; } List operations = new ArrayList<>(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 08ecaeaf1..5b92a8ad3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -114,12 +114,12 @@ public class FastModeExtent extends AbstractDelegateExtent { } public boolean commitRequired() { - return (enabled && !dirtyChunks.isEmpty()) || (postEditSimulation && !positions.isEmpty()); + return enabled || postEditSimulation; } @Override protected Operation commitBefore() { - if (!enabled && !postEditSimulation) { + if (!commitRequired()) { return null; } return new Operation() {