mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 20:16:00 +01:00
Change image response to 204 and always save an empty players.json
This commit is contained in:
parent
701f6cb2dc
commit
c2499df3a7
@ -131,9 +131,18 @@ public HttpResponse handle(HttpRequest request) {
|
|||||||
return new HttpResponse(HttpStatusCode.INTERNAL_SERVER_ERROR);
|
return new HttpResponse(HttpStatusCode.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse response = new HttpResponse(HttpStatusCode.OK);
|
if (path.endsWith(".png")) {
|
||||||
response.setData("{}");
|
return new HttpResponse(HttpStatusCode.NO_CONTENT);
|
||||||
return response;
|
}
|
||||||
|
|
||||||
|
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) {
|
private String calculateETag(String path, TileInfo tileInfo) {
|
||||||
|
@ -30,6 +30,7 @@ public enum HttpStatusCode {
|
|||||||
PROCESSING (102, "Processing"),
|
PROCESSING (102, "Processing"),
|
||||||
|
|
||||||
OK (200, "OK"),
|
OK (200, "OK"),
|
||||||
|
NO_CONTENT (204, "No Content"),
|
||||||
|
|
||||||
MOVED_PERMANENTLY (301, "Moved Permanently"),
|
MOVED_PERMANENTLY (301, "Moved Permanently"),
|
||||||
FOUND (302, "Found"),
|
FOUND (302, "Found"),
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
import de.bluecolored.bluemap.core.world.World;
|
import de.bluecolored.bluemap.core.world.World;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -134,6 +135,7 @@ public synchronized void save() {
|
|||||||
lowresTileManager.save();
|
lowresTileManager.save();
|
||||||
saveRenderState();
|
saveRenderState();
|
||||||
saveMarkerState();
|
saveMarkerState();
|
||||||
|
savePlayerState();
|
||||||
saveMapSettings();
|
saveMapSettings();
|
||||||
|
|
||||||
// only save texture gallery if not present in storage
|
// 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() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user