Close server socket before world saving

This commit is contained in:
2025-07-10 10:23:28 +02:00
parent 9d6981ee0c
commit 2be4118399
@@ -94,8 +94,6 @@ class CheckpointUtilsJ9 {
private static final Reflection.Method bind = Reflection.getMethod(TinyProtocol.serverConnection, null, InetAddress.class, int.class); private static final Reflection.Method bind = Reflection.getMethod(TinyProtocol.serverConnection, null, InetAddress.class, int.class);
private static void freezeInternal(Path path) throws Exception { private static void freezeInternal(Path path) throws Exception {
Bukkit.getPluginManager().callEvent(new CRIUSleepEvent()); Bukkit.getPluginManager().callEvent(new CRIUSleepEvent());
Bukkit.getWorlds().forEach(FlatteningWrapper.impl::syncSave);
Statement.closeAll();
// Close socket // Close socket
Object serverConnection = TinyProtocol.getServerConnection(Core.getInstance()); Object serverConnection = TinyProtocol.getServerConnection(Core.getInstance());
@@ -105,6 +103,9 @@ class CheckpointUtilsJ9 {
} }
channels.clear(); channels.clear();
Bukkit.getWorlds().forEach(FlatteningWrapper.impl::syncSave);
Statement.closeAll();
System.runFinalization(); System.runFinalization();
System.gc(); System.gc();