diff --git a/core/src/main/java/com/boydti/fawe/config/Settings.java b/core/src/main/java/com/boydti/fawe/config/Settings.java index 58826768..4dd29ab8 100644 --- a/core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/core/src/main/java/com/boydti/fawe/config/Settings.java @@ -142,7 +142,7 @@ public class Settings extends Config { " or increase chunk-wait-ms.", "A value of 0 is faster simply because it doesn't bother loading the chunks or waiting.", }) - public static int CHUNK_WAIT_MS = 100; + public static int CHUNK_WAIT_MS = 1000; @Comment("Delete history on disk after a number of days") public static int DELETE_AFTER_DAYS = 7; @Comment("Delete history in memory on logout (does not effect disk) (BROKEN, USE DISK INSTEAD)") diff --git a/core/src/main/java/com/boydti/fawe/example/NMSMappedFaweQueue.java b/core/src/main/java/com/boydti/fawe/example/NMSMappedFaweQueue.java index b860519e..9be3ee08 100644 --- a/core/src/main/java/com/boydti/fawe/example/NMSMappedFaweQueue.java +++ b/core/src/main/java/com/boydti/fawe/example/NMSMappedFaweQueue.java @@ -1,9 +1,11 @@ package com.boydti.fawe.example; +import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.FaweChunk; import com.boydti.fawe.object.exception.FaweException; +import com.boydti.fawe.util.SetQueue; import com.boydti.fawe.util.TaskManager; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.world.World; @@ -56,7 +58,7 @@ public abstract class NMSMappedFaweQueue ex public void end(FaweChunk chunk) { super.end(chunk); if (Settings.LIGHTING.MODE == 0) { - refreshChunk(chunk); + sendChunk(chunk); return; } if (relighter == null) { @@ -79,13 +81,22 @@ public abstract class NMSMappedFaweQueue ex if (relight) { relighter.addChunk(chunk.getX(), chunk.getZ(), fix, chunk.getBitMask()); } else { - refreshChunk(chunk); + sendChunk(chunk); } } @Override public void sendChunk(final FaweChunk fc) { - refreshChunk(fc); + if (Fawe.get().isMainThread()) { + refreshChunk(fc); + } else { + SetQueue.IMP.addTask(new Runnable() { + @Override + public void run() { + refreshChunk(fc); + } + }); + } } public abstract void setFullbright(CHUNKSECTION sections); diff --git a/core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAQueue.java b/core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAQueue.java index 41f5c958..05b3ec1f 100644 --- a/core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAQueue.java +++ b/core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAQueue.java @@ -210,7 +210,7 @@ public class MCAQueue extends NMSMappedFaweQueue * - Useful if you need to access something from the Bukkit API from another thread
diff --git a/core/src/main/java/com/boydti/fawe/wrappers/PlayerWrapper.java b/core/src/main/java/com/boydti/fawe/wrappers/PlayerWrapper.java index 3911721e..116f9e9f 100644 --- a/core/src/main/java/com/boydti/fawe/wrappers/PlayerWrapper.java +++ b/core/src/main/java/com/boydti/fawe/wrappers/PlayerWrapper.java @@ -199,19 +199,27 @@ public class PlayerWrapper implements Player { @Override public void floatAt(final int x, final int y, final int z, final boolean alwaysGlass) { EditSessionFactory factory = WorldEdit.getInstance().getEditSessionFactory(); - final EditSession edit = factory.getEditSession(parent.getWorld(), -1, null, this); - edit.setBlockFast(new Vector(x, y - 1, z), new BaseBlock( BlockType.GLASS.getID())); - LocalSession session = Fawe.get().getWorldEdit().getSession(this); - if (session != null) { - session.remember(edit, true, false, FawePlayer.wrap(this).getLimit().MAX_HISTORY); + RuntimeException caught = null; + try { + final EditSession edit = factory.getEditSession(parent.getWorld(), -1, null, this); + edit.setBlockFast(new Vector(x, y - 1, z), new BaseBlock(BlockType.GLASS.getID())); + edit.flushQueue(); + LocalSession session = Fawe.get().getWorldEdit().getSession(this); + if (session != null) { + session.remember(edit, true, false, FawePlayer.wrap(this).getLimit().MAX_HISTORY); + } + } catch (RuntimeException e) { + caught = e; } TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { - edit.getQueue().flush(); setPosition(new Vector(x + 0.5, y, z + 0.5)); } }); + if (caught != null) { + throw caught; + } } @Override