diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java index d8ce0c2b1..efb2a13c3 100644 --- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java @@ -449,15 +449,17 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc TextComponent.of("Could not get chunk at " + chunkX + "," + chunkZ + " whilst low memory: " + e.getMessage())); } } + final int finalCopyKey = copyKey; // Run immediately if possible if (chunk != null) { - return internalCall(set, finalizer, chunk, nmsWorld); + return internalCall(set, finalizer, finalCopyKey, chunk, nmsWorld); } // Submit via the STQE as that will help handle excessive queuing by waiting for the submission count to fall below the // target size nmsChunkFuture.thenApply(nmsChunk -> owner.submitTaskUnchecked(() -> (T) internalCall( set, finalizer, + finalCopyKey, nmsChunk, nmsWorld ))); @@ -467,7 +469,13 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc return (T) (Future) CompletableFuture.completedFuture(null); } - private > T internalCall(IChunkSet set, Runnable finalizer, LevelChunk nmsChunk, ServerLevel nmsWorld) { + private > T internalCall( + IChunkSet set, + Runnable finalizer, + int copyKey, + LevelChunk nmsChunk, + ServerLevel nmsWorld + ) { try { PaperweightGetBlocks_Copy copy = createCopy ? new PaperweightGetBlocks_Copy(nmsChunk) : null; if (createCopy) {