forked from mirror/BlueMap
Fix paper-implementation not saving the world on the main thread
This commit is contained in:
parent
e9e7042aed
commit
a0e9180360
@ -28,11 +28,14 @@
|
||||
import de.bluecolored.bluemap.core.resources.datapack.DataPack;
|
||||
import de.bluecolored.bluemap.core.util.Key;
|
||||
import de.bluecolored.bluemap.core.world.mca.MCAWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class BukkitWorld implements ServerWorld {
|
||||
|
||||
@ -71,7 +74,10 @@ public boolean persistWorldChanges() {
|
||||
if (!FoliaSupport.IS_FOLIA) {
|
||||
World world = delegate.get();
|
||||
if (world != null) {
|
||||
world.save();
|
||||
Executor mainThread = Bukkit.getScheduler().getMainThreadExecutor(BukkitPlugin.getInstance());
|
||||
CompletableFuture
|
||||
.runAsync(world::save, mainThread)
|
||||
.join();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user