From ae941e67a4b38e4f91f41962a69cb7dd88c8f353 Mon Sep 17 00:00:00 2001 From: Pierre Maurice Schwang Date: Sun, 21 Jan 2024 12:40:38 +0100 Subject: [PATCH] Fallback to areas QueueCoordinator when passing null (#4300) * fix: fallback to area QueueCoordinator if null passed * chore: add annotations to suppress IDE warnings --- .../plotsquared/bukkit/util/fawe/FaweRegionManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java index 5fe07a80d..7c502ed8f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java @@ -37,7 +37,9 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; +import java.util.Objects; import java.util.Set; public class FaweRegionManager extends BukkitRegionManager { @@ -59,7 +61,10 @@ public class FaweRegionManager extends BukkitRegionManager { @Nullable PlotPlayer actor, @Nullable QueueCoordinator queue ) { - return delegate.setCuboids(area, regions, blocks, minY, maxY, queue.getCompleteTask()); + return delegate.setCuboids( + area, regions, blocks, minY, maxY, + Objects.requireNonNullElseGet(queue, area::getQueue).getCompleteTask() + ); } @Override @@ -111,7 +116,7 @@ public class FaweRegionManager extends BukkitRegionManager { } @Override - public boolean regenerateRegion(final Location pos1, final Location pos2, boolean ignore, final Runnable whenDone) { + public boolean regenerateRegion(final @NotNull Location pos1, final @NotNull Location pos2, boolean ignore, final Runnable whenDone) { return delegate.regenerateRegion(pos1, pos2, ignore, whenDone); }