From 0d112b291315dac6e4c6b37a7193e1009df47a2b Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 23 Oct 2022 20:22:53 +0100 Subject: [PATCH] fix: move main-thread call to be implementation from WorldWrapper (#1991) - Fixes #1990 --- .../main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 6 ++++-- .../com/fastasyncworldedit/core/wrappers/WorldWrapper.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index c4316584e..769bcbd03 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -144,7 +144,7 @@ public class BukkitWorld extends AbstractWorld { public List getEntities(Region region) { World world = getWorld(); - List ents = world.getEntities(); + List ents = TaskManager.taskManager().sync(world::getEntities); List entities = new ArrayList<>(); for (Entity ent : ents) { if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) { @@ -157,7 +157,9 @@ public class BukkitWorld extends AbstractWorld { @Override public List getEntities() { List list = new ArrayList<>(); - for (Entity entity : getWorld().getEntities()) { + + List ents = TaskManager.taskManager().sync(getWorld()::getEntities); + for (Entity entity : ents) { list.add(BukkitAdapter.adapt(entity)); } return list; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java index dcf2365b2..05616a414 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java @@ -320,12 +320,12 @@ public class WorldWrapper extends AbstractWorld { @Override public List getEntities(Region region) { - return TaskManager.taskManager().sync(() -> parent.getEntities(region)); + return parent.getEntities(region); } @Override public List getEntities() { - return TaskManager.taskManager().sync(parent::getEntities); + return parent.getEntities(); } @Override