Properly wait for queue to flush

- Ensuring the queue is flushed may wait slightly longer than necessary
This commit is contained in:
Jesse Boyd 2016-08-14 14:26:46 +10:00
parent 3a3fcca8b0
commit 80045cfa6c
3 changed files with 14 additions and 11 deletions

View File

@ -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"),

View File

@ -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;
}
}

View File

@ -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();
}
}