diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java index 5fc59cb41..68dccaab5 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java @@ -14,6 +14,7 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.mojang.authlib.GameProfile; +import io.akarin.server.core.AkarinAsyncExecutor; import io.akarin.server.misc.CopyOnWriteHashMap; import java.io.BufferedReader; @@ -31,6 +32,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.logging.Level; import javax.annotation.Nullable; import org.apache.commons.io.IOUtils; @@ -178,6 +180,7 @@ public class JsonList> { public void save() throws IOException { this.removeStaleEntries(); // Paper - remove expired values before saving + Runnable runnable = () -> { // Akarin Collection collection = this.d.values(); String s = this.b.toJson(collection); BufferedWriter bufferedwriter = null; @@ -185,9 +188,13 @@ public class JsonList> { try { bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8); bufferedwriter.write(s); + } catch (IOException e) { // Akarin + Bukkit.getLogger().log(Level.SEVERE, "Failed to save {0}, {1}", new Object[] {this.c.getName(), e.getMessage()}); // Akarin } finally { IOUtils.closeQuietly(bufferedwriter); } + }; // Akarin + AkarinAsyncExecutor.scheduleSingleAsyncTask(runnable); // Akarin }