From 71059505d19436529c6d8608f07e1dfe600c2a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sat, 26 Dec 2020 21:00:45 +0100 Subject: [PATCH] Implement missing AsyncChunk#getTileEntities --- .../com/boydti/fawe/bukkit/wrapper/AsyncChunk.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java index 590668be6..030e86c78 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java @@ -6,6 +6,7 @@ import com.boydti.fawe.util.TaskManager; import org.bukkit.Chunk; import org.bukkit.ChunkSnapshot; import org.bukkit.World; +import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.bukkit.entity.Entity; @@ -14,6 +15,8 @@ import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; import java.util.Collection; +import java.util.Collections; +import java.util.function.Predicate; import java.util.function.Supplier; public class AsyncChunk implements Chunk { @@ -120,6 +123,16 @@ public class AsyncChunk implements Chunk { return TaskManager.IMP.sync(() -> world.getChunkAt(x, z).getTileEntities(useSnapshot)); } + @NotNull @Override + public Collection getTileEntities(@NotNull Predicate blockPredicate, + boolean useSnapshot) { + if (!isLoaded()) { + return Collections.emptyList(); + } + return TaskManager.IMP.sync(() -> world.getChunkAt(x, z) + .getTileEntities(blockPredicate, useSnapshot)); + } + @Override public boolean isLoaded() { return world.isChunkLoaded(x, z);