diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java index 803281da..586f343b 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/MapStorageRequestHandler.java @@ -131,9 +131,18 @@ public HttpResponse handle(HttpRequest request) { return new HttpResponse(HttpStatusCode.INTERNAL_SERVER_ERROR); } - HttpResponse response = new HttpResponse(HttpStatusCode.OK); - response.setData("{}"); - return response; + if (path.endsWith(".png")) { + return new HttpResponse(HttpStatusCode.NO_CONTENT); + } + + if (path.endsWith(".json")) { + HttpResponse response = new HttpResponse(HttpStatusCode.OK); + response.addHeader("Content-Type", "application/json"); + response.setData("{}"); + return response; + } + + return new HttpResponse(HttpStatusCode.NOT_FOUND); } private String calculateETag(String path, TileInfo tileInfo) { diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/http/HttpStatusCode.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/http/HttpStatusCode.java index 3d7ba7e5..69407096 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/http/HttpStatusCode.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/web/http/HttpStatusCode.java @@ -30,6 +30,7 @@ public enum HttpStatusCode { PROCESSING (102, "Processing"), OK (200, "OK"), + NO_CONTENT (204, "No Content"), MOVED_PERMANENTLY (301, "Moved Permanently"), FOUND (302, "Found"), diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/BmMap.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/BmMap.java index 763072db..b4c62766 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/BmMap.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/BmMap.java @@ -39,6 +39,7 @@ import de.bluecolored.bluemap.core.world.World; import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -134,6 +135,7 @@ public synchronized void save() { lowresTileManager.save(); saveRenderState(); saveMarkerState(); + savePlayerState(); saveMapSettings(); // only save texture gallery if not present in storage @@ -215,6 +217,16 @@ public synchronized void saveMarkerState() { } } + public synchronized void savePlayerState() { + try ( + OutputStream out = storage.writeMeta(id, META_FILE_PLAYERS); + ) { + out.write("{}".getBytes(StandardCharsets.UTF_8)); + } catch (Exception ex) { + Logger.global.logError("Failed to save markers for map '" + getId() + "'!", ex); + } + } + public String getId() { return id; }