From 8ce85322ddceda3165ef5fd28c9b0132d6b792f7 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Sat, 1 Oct 2022 20:39:46 +0200 Subject: [PATCH] Stringify json for json file client async --- .../java/org/dynmap/JsonFileClientUpdateComponent.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DynmapCore/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java b/DynmapCore/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java index c3a2f5b7..ceeac3a5 100644 --- a/DynmapCore/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java +++ b/DynmapCore/src/main/java/org/dynmap/JsonFileClientUpdateComponent.java @@ -27,6 +27,7 @@ import org.json.simple.parser.ParseException; import static org.dynmap.JSONUtils.*; import java.nio.charset.Charset; +import java.util.concurrent.CompletableFuture; public class JsonFileClientUpdateComponent extends ClientUpdateComponent { protected long jsonInterval; @@ -338,9 +339,12 @@ public class JsonFileClientUpdateComponent extends ClientUpdateComponent { else { outputFile = "dynmap_" + dynmapWorld.getName() + ".json"; } - byte[] content = Json.stringifyJson(update).getBytes(cs_utf8); - enqueueFileWrite(outputFile, content, dowrap); + CompletableFuture.runAsync(() -> { + byte[] content = Json.stringifyJson(update).getBytes(cs_utf8); + + enqueueFileWrite(outputFile, content, dowrap); + }); } }