From a8621a15ad408bd6b3561021b0c992bcbc99e81b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 6 May 2020 12:37:33 +0100 Subject: [PATCH] Override setblock setting Pattern in ChunkBlockQueue > Should stop NPE during plot analysis > Without overriding this method, DelegateLocalBlockQueue setblock Pattern is called > DelegateLocalBlockQueue's setblocks use parent.setBlock, but we set that to null in ChunkBlockQueue > ChunkBlockQueue is simply just to cache the values from generation to use in analysis > Therefore there is no need to setblocks in any other Queue implementation --- .../java/com/plotsquared/core/queue/ChunkBlockQueue.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java index 17bd6eb83..a8e0d1c1a 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java +++ b/Core/src/main/java/com/plotsquared/core/queue/ChunkBlockQueue.java @@ -26,6 +26,7 @@ package com.plotsquared.core.queue; import com.plotsquared.core.location.Location; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; @@ -79,6 +80,11 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue { return true; } + @Override public boolean setBlock(int x, int y, int z, Pattern pattern) { + this.storeCache(x, y, z, pattern.apply(BlockVector3.at(x, y, z)).toImmutableState()); + return true; + } + private void storeCache(final int x, final int y, final int z, final BlockState id) { BlockState[][] resultY = result[y]; if (resultY == null) {