fix: move main-thread call to be implementation from WorldWrapper (#1991)

- Fixes #1990
Dieser Commit ist enthalten in:
Jordan 2022-10-23 20:22:53 +01:00 committet von GitHub
Ursprung bf28ab47b8
Commit 0d112b2913
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -144,7 +144,7 @@ public class BukkitWorld extends AbstractWorld {
public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) { public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) {
World world = getWorld(); World world = getWorld();
List<Entity> ents = world.getEntities(); List<Entity> ents = TaskManager.taskManager().sync(world::getEntities);
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>(); List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
for (Entity ent : ents) { for (Entity ent : ents) {
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) { if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
@ -157,7 +157,9 @@ public class BukkitWorld extends AbstractWorld {
@Override @Override
public List<com.sk89q.worldedit.entity.Entity> getEntities() { public List<com.sk89q.worldedit.entity.Entity> getEntities() {
List<com.sk89q.worldedit.entity.Entity> list = new ArrayList<>(); List<com.sk89q.worldedit.entity.Entity> list = new ArrayList<>();
for (Entity entity : getWorld().getEntities()) {
List<Entity> ents = TaskManager.taskManager().sync(getWorld()::getEntities);
for (Entity entity : ents) {
list.add(BukkitAdapter.adapt(entity)); list.add(BukkitAdapter.adapt(entity));
} }
return list; return list;

Datei anzeigen

@ -320,12 +320,12 @@ public class WorldWrapper extends AbstractWorld {
@Override @Override
public List<? extends Entity> getEntities(Region region) { public List<? extends Entity> getEntities(Region region) {
return TaskManager.taskManager().sync(() -> parent.getEntities(region)); return parent.getEntities(region);
} }
@Override @Override
public List<? extends Entity> getEntities() { public List<? extends Entity> getEntities() {
return TaskManager.taskManager().sync(parent::getEntities); return parent.getEntities();
} }
@Override @Override