From 66e22df3f4c505a0a302d47c0c10302275e2a191 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 12 Sep 2021 11:35:28 +0100 Subject: [PATCH] Remove unneeded IQueueWrapper, clean up some queue classes slightly --- .../core/extent/filter/MaskFilter.java | 2 +- .../core/queue/IQueueExtent.java | 17 ++++------------- .../core/queue/IQueueWrapper.java | 9 --------- .../implementation/ParallelQueueExtent.java | 15 +++------------ 4 files changed, 8 insertions(+), 35 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java index d56fc71c3..9284f8378 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java @@ -31,7 +31,7 @@ public class MaskFilter extends DelegateFilter { @Override public void applyBlock(FilterBlock block) { if (mask instanceof AbstractExtentMask) { - if (((AbstractExtentMask) mask).test(block, block)) { + if (((AbstractExtentMask) mask).test(block.getExtent(), block)) { getParent().applyBlock(block); this.changes.incrementAndGet(); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java index e2b0349bc..c081475ce 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java @@ -41,36 +41,27 @@ public interface IQueueExtent extends Flushable, Trimable, ICh /** * Initialize the queue (for reusability) * - * @param extent - * @param get - * @param set + * @param extent extent to use + * @param get cache of chunk GET + * @param set cache of chunk SET */ void init(Extent extent, IChunkCache get, IChunkCache set); /** * Get the cached get object. This is faster than getting the object using NMS and allows for * wrapping. - * - * @param chunkX - * @param chunkZ - * @return */ IChunkGet getCachedGet(@Range(from = 0, to = 15) int chunkX, @Range(from = 0, to = 15) int chunkZ); /** * Get the cached chunk set object. - * - * @param chunkX - * @param chunkZ - * @return */ IChunkSet getCachedSet(@Range(from = 0, to = 15) int chunkX, @Range(from = 0, to = 15) int chunkZ); /** * Submit the chunk so that it's changes are applied to the world * - * @param chunk - * @return result + * @return Future */ > V submit(T chunk); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java deleted file mode 100644 index 9566a2fbf..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastasyncworldedit.core.queue; - -public interface IQueueWrapper { - - default IQueueExtent wrapQueue(IQueueExtent queue) { - return queue; - } - -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java index 1394c5e9f..58671f0ba 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java @@ -17,7 +17,6 @@ import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.queue.Filter; import com.fastasyncworldedit.core.queue.IQueueChunk; import com.fastasyncworldedit.core.queue.IQueueExtent; -import com.fastasyncworldedit.core.queue.IQueueWrapper; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.BlockMask; @@ -43,7 +42,7 @@ import java.util.Set; import java.util.concurrent.ForkJoinTask; import java.util.stream.IntStream; -public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrapper { +public class ParallelQueueExtent extends PassthroughExtent { private static final Logger LOGGER = LogManagerCompat.getLogger(); @@ -54,8 +53,8 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap // Array for lazy avoidance of concurrent modification exceptions and needless overcomplication of code (synchronisation is // not very important) private final boolean[] faweExceptionReasonsUsed = new boolean[FaweException.Type.values().length]; - private int changes; private final boolean fastmode; + private int changes; private int lastException = Integer.MIN_VALUE; private int exceptionCount = 0; @@ -90,15 +89,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap } private IQueueExtent getNewQueue() { - return wrapQueue(handler.getQueue(this.world, this.processor, this.postProcessor)); - } - - @Override - public IQueueExtent wrapQueue(IQueueExtent queue) { - // TODO wrap - queue.setProcessor(this.processor); - queue.setPostProcessor(this.postProcessor); - return queue; + return handler.getQueue(world, this.processor, this.postProcessor); } @Override