Fixed ZoneData property names being serialized incorrectly

This commit is contained in:
kuroppoi 2022-07-22 23:25:28 +02:00
parent c120ab5d79
commit 2dead799e3
2 changed files with 12 additions and 3 deletions

View file

@ -79,8 +79,15 @@ public class Zone {
this(documentId, config.getName(), config.getBiome(), config.getWidth(), config.getHeight());
surface = data.getSurface();
sunlight = data.getSunlight();
pendingSunlight.addAll(data.getPendingSunlight());
chunksExplored = data.getChunksExplored();
// Ha ha silly me!
if(data.getPendingSunlight() != null) {
pendingSunlight.addAll(data.getPendingSunlight());
}
if(data.getChunksExplored() != null) {
chunksExplored = data.getChunksExplored();
}
}
public Zone(String documentId, String name, Biome biome, int width, int height) {

View file

@ -20,6 +20,7 @@ import org.msgpack.core.MessageUnpacker;
import org.msgpack.jackson.dataformat.MessagePackFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import brainwine.gameserver.util.ZipUtils;
import brainwine.gameserver.zone.gen.ZoneGenerator;
@ -28,7 +29,8 @@ import brainwine.shared.JsonHelper;
public class ZoneManager {
private static final Logger logger = LogManager.getLogger();
private final ObjectMapper mapper = new ObjectMapper(new MessagePackFactory());
private final ObjectMapper mapper = new ObjectMapper(new MessagePackFactory())
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
private final File dataDir = new File("zones");
private Map<String, Zone> zones = new HashMap<>();
private Map<String, Zone> zonesByName = new HashMap<>();