fix: fixed proper serialization of MoveEvents

This commit is contained in:
Yannik Bretschneider 2021-06-03 22:14:16 +02:00
parent e0258b5dc8
commit 4354adda2a

View File

@ -97,10 +97,15 @@ public class EventSerializer extends StdSerializer<Event> {
SerializerProvider provider)
throws IOException {
gen.writeObjectField("originEntity", value.originEntity);
gen.writeObjectField("targetEntity", value.targetEntity);
if (value.type != EventType.MoveEvent) {
gen.writeObjectField("targetEntity", value.targetEntity);
}
gen.writeObjectField("originField", value.originField);
gen.writeObjectField("targetField", value.targetField);
if (value.type == EventType.UseInfinityStoneEvent || value.type == EventType.ExchangeInfinityStoneEvent) {
gen.writeObjectField("stoneType", new EntityID(EntityType.InfinityStones, value.stoneType.getID()));
}