mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-24 03:25:17 +01:00
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.resources.datapack.DataPack;
|
||||||
import de.bluecolored.bluemap.core.util.Key;
|
import de.bluecolored.bluemap.core.util.Key;
|
||||||
import de.bluecolored.bluemap.core.world.mca.MCAWorld;
|
import de.bluecolored.bluemap.core.world.mca.MCAWorld;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
public class BukkitWorld implements ServerWorld {
|
public class BukkitWorld implements ServerWorld {
|
||||||
|
|
||||||
@ -71,7 +74,10 @@ public boolean persistWorldChanges() {
|
|||||||
if (!FoliaSupport.IS_FOLIA) {
|
if (!FoliaSupport.IS_FOLIA) {
|
||||||
World world = delegate.get();
|
World world = delegate.get();
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
world.save();
|
Executor mainThread = Bukkit.getScheduler().getMainThreadExecutor(BukkitPlugin.getInstance());
|
||||||
|
CompletableFuture
|
||||||
|
.runAsync(world::save, mainThread)
|
||||||
|
.join();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user