From 6afc7501db49e87cf44c7d545e5502523b1b60d6 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 21 Jul 2023 12:37:04 +0100 Subject: [PATCH] add getter and setter for task --- .../core/extent/OncePerChunkExtent.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java index 9869fede1..5125ad9bc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OncePerChunkExtent.java @@ -17,6 +17,8 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import java.util.Objects; import java.util.function.Consumer; /** @@ -28,7 +30,7 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch private final LocalBlockVector2Set set = new LocalBlockVector2Set(); private final IQueueExtent queue; - private final Consumer task; + private Consumer task; private volatile long lastPair = Long.MAX_VALUE; private volatile boolean isProcessing; @@ -40,10 +42,14 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch * @param task Consumer task for the chunk GET * @since TODO */ - public OncePerChunkExtent(Extent extent, IQueueExtent queue, Consumer task) { + public OncePerChunkExtent( + @Nonnull Extent extent, + @Nonnull IQueueExtent queue, + @Nonnull Consumer task + ) { super(extent); - this.queue = queue; - this.task = task; + this.queue = Objects.requireNonNull(queue); + this.task = Objects.requireNonNull(task); } private boolean shouldRun(int chunkX, int chunkZ) { @@ -67,6 +73,14 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch } } + public Consumer getTask() { + return task; + } + + public void setTask(Consumer task) { + this.task = task; + } + @Override public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) { return set;