From 818a7ac41f2454f33aa6d1c1247f8cd62a9194b4 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 14 Sep 2024 18:38:14 +0100 Subject: [PATCH] Add comment --- .../adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java | 5 +++++ 1 file changed, 5 insertions(+) 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 4ddc9214e..5c4e37bb4 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 @@ -443,12 +443,17 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc if (chunk != null) { return internalCall(set, finalizer, 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, nmsChunk, nmsWorld ))); + // If we have re-submitted, return a completed future to prevent potential deadlocks where a future reliant on the + // above submission is halting the BlockingExecutor, and preventing the above task from actually running. The futures + // submitted above will still be added to the STQE submissions. return (T) (Future) CompletableFuture.completedFuture(null); }