From 80045cfa6c75ca72c73d2cfd99d529c87461953b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 14 Aug 2016 14:26:46 +1000 Subject: [PATCH] Properly wait for queue to flush - Ensuring the queue is flushed may wait slightly longer than necessary --- core/src/main/java/com/boydti/fawe/config/BBC.java | 2 +- .../boydti/fawe/object/exception/FaweException.java | 11 ++++++++--- .../main/java/com/sk89q/worldedit/EditSession.java | 12 +++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/config/BBC.java b/core/src/main/java/com/boydti/fawe/config/BBC.java index 60cc24f8..97470bba 100644 --- a/core/src/main/java/com/boydti/fawe/config/BBC.java +++ b/core/src/main/java/com/boydti/fawe/config/BBC.java @@ -63,7 +63,7 @@ public enum BBC { COMMAND_UNDO_FAIL("Nothing left to undo.", "WorldEdit.History"), COMMAND_UNDO_SUCCESS("Undo successful.", "WorldEdit.History"), - OPERATION("Operation complete (%s0)", "WorldEdit.Operation"), + OPERATION("Operation queued (%s0)", "WorldEdit.Operation"), SELECTION_WAND("Left click: select pos #1; Right click: select pos #2", "WorldEdit.Selection"), SELECTION_WAND_DISABLE("Edit wand disabled.", "WorldEdit.Selection"), diff --git a/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java b/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java index cd5d10b4..461d4c69 100644 --- a/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java +++ b/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java @@ -3,15 +3,15 @@ package com.boydti.fawe.object.exception; import com.boydti.fawe.config.BBC; public class FaweException extends RuntimeException { - private final String message; + private final BBC message; public FaweException(BBC reason) { - this.message = reason.format(); + this.message = reason; } @Override public String getMessage() { - return message; + return message == null ? null : message.format(); } public static FaweException get(Throwable e) { @@ -30,4 +30,9 @@ public class FaweException extends RuntimeException { super(BBC.WORLDEDIT_FAILED_LOAD_CHUNK); } } + + @Override + public Throwable fillInStackTrace() { + return this; + } } diff --git a/core/src/main/java/com/sk89q/worldedit/EditSession.java b/core/src/main/java/com/sk89q/worldedit/EditSession.java index 452e36ca..bd2a7733 100644 --- a/core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -1103,14 +1103,12 @@ public class EditSession implements Extent { queue.dequeue(); return; } + if (Fawe.get().isMainThread()) { + SetQueue.IMP.flush(queue); + } else { + queue.flush(); + } if (getChangeSet() != null) { - if (Settings.HISTORY.COMBINE_STAGES && queue.size() > 0) { - if (Fawe.get().isMainThread()) { - SetQueue.IMP.flush(queue); - } else { - queue.flush(); - } - } ((FaweChangeSet) getChangeSet()).flush(); } }