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
This commit is contained in:
dordsor21 2020-05-06 12:37:33 +01:00
parent 179e9e1e74
commit a8621a15ad

View File

@ -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) {