From f0d998e2c0cc941cd8b0e3b10b2e976ab4a34e60 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Mon, 21 Jan 2019 12:31:31 +0100 Subject: [PATCH] Attempt to fix #2154 --- .../util/block/BukkitLocalQueue_1_8_3.java | 8 ++++++++ .../util/block/BukkitLocalQueue_1_9.java | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_8_3.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_8_3.java index 90982a1cc..bb7744d25 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_8_3.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_8_3.java @@ -279,6 +279,14 @@ public class BukkitLocalQueue_1_8_3 extends BukkitLocalQueue { Map tiles = (Map) tileEntities.get(c); Collection[] entities = (Collection[]) entitySlices.get(c); + // We need to update entities to make it mutable + for (int i = 0; i < entities.length; i++) { + final Collection list = new ArrayList<>(entities[i]); + entities[i] = list; + } + // Force update the field. This shouldn't be necessary, but weird stuff happened + entitySlices.set(c, entities); + Method getX = null; Method getY = null; Method getZ = null; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_9.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_9.java index 351a69243..75e662aac 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_9.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/block/BukkitLocalQueue_1_9.java @@ -5,17 +5,13 @@ import com.intellectualcrafters.plot.object.PseudoRandom; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.ReflectionUtils; import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; import org.bukkit.Chunk; import org.bukkit.Material; import org.bukkit.World; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.*; import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; @@ -256,6 +252,14 @@ public class BukkitLocalQueue_1_9 extends BukkitLocalQueue { Map tiles = (Map) tf.get(c); Collection[] entities = (Collection[]) entitySlices.get(c); + // We need to update entities to make it mutable + for (int i = 0; i < entities.length; i++) { + final Collection list = new ArrayList<>(entities[i]); + entities[i] = list; + } + // Force update the field. This shouldn't be necessary, but weird stuff happened + entitySlices.set(c, entities); + Method xm = null; Method ym = null; Method zm = null;