From f0066bbd26d32aba216267a1702b28a2cbd8eda9 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 13 Aug 2017 13:13:03 +1000 Subject: [PATCH] Don't use relighter for non nms placer --- .../fawe/bukkit/v0/BukkitQueue_All.java | 26 ++++++++++++++++--- .../fawe/example/NMSMappedFaweQueue.java | 8 +++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_All.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_All.java index c536f8dc..60a11a2f 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_All.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_All.java @@ -2,6 +2,8 @@ package com.boydti.fawe.bukkit.v0; import com.boydti.fawe.FaweCache; import com.boydti.fawe.config.Settings; +import com.boydti.fawe.example.NullRelighter; +import com.boydti.fawe.example.Relighter; import com.boydti.fawe.object.FaweChunk; import com.boydti.fawe.object.RegionWrapper; import com.boydti.fawe.object.RunnableVal; @@ -9,6 +11,7 @@ import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.SetQueue; import com.boydti.fawe.util.TaskManager; +import com.google.common.collect.MapMaker; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.blocks.BaseBlock; import java.io.File; @@ -17,6 +20,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayDeque; import java.util.Map; +import java.util.concurrent.ConcurrentMap; import org.bukkit.Chunk; import org.bukkit.ChunkSnapshot; import org.bukkit.Location; @@ -27,6 +31,9 @@ public class BukkitQueue_All extends BukkitQueue_0 chunkCache = new MapMaker() + .weakValues() + .makeMap(); public BukkitQueue_All(com.sk89q.worldedit.world.World world) { super(world); @@ -46,6 +53,11 @@ public class BukkitQueue_All extends BukkitQueue_0 classRegionFileCache; private static Class classRegionFile; private static Class classCraftChunk; @@ -220,13 +232,15 @@ public class BukkitQueue_All extends BukkitQueue_0 ex @Override public void runTasks() { super.runTasks(); - if (!relighter.isEmpty()) { + if (!getRelighter().isEmpty()) { TaskManager.IMP.taskNowAsync(new Runnable() { @Override public void run() { - relighter.fixLightingSafe(hasSky()); + getRelighter().fixLightingSafe(hasSky()); } }); } @@ -66,7 +66,7 @@ public abstract class NMSMappedFaweQueue ex sendChunk(chunk); } if (Settings.IMP.LIGHTING.MODE == 2) { - relighter.addChunk(chunk.getX(), chunk.getZ(), null, chunk.getBitMask()); + getRelighter().addChunk(chunk.getX(), chunk.getZ(), null, chunk.getBitMask()); return; } CharFaweChunk cfc = (CharFaweChunk) chunk; @@ -90,7 +90,7 @@ public abstract class NMSMappedFaweQueue ex } } if (relight) { - relighter.addChunk(chunk.getX(), chunk.getZ(), fix, chunk.getBitMask()); + getRelighter().addChunk(chunk.getX(), chunk.getZ(), fix, chunk.getBitMask()); } else if (Settings.IMP.LIGHTING.DELAY_PACKET_SENDING) { sendChunk(chunk); }