From f09b9e23889fb1b960e871c587016bc56a97cc7f Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Tue, 11 May 2021 06:14:43 +0200 Subject: [PATCH] feat: connected deserializers to classes --- .../teamname/marvelous/gamelibrary/entities/EntityID.java | 6 ++++++ .../uulm/teamname/marvelous/gamelibrary/events/Event.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java index a06fbe4..c6eb5f1 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java @@ -1,13 +1,19 @@ package uulm.teamname.marvelous.gamelibrary.entities; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import uulm.teamname.marvelous.gamelibrary.json.ingame.EntityIDDeserializer; + import java.util.Objects; /** Represents a distinct identification for every {@link Entity} in a game. */ +@JsonDeserialize(using = EntityIDDeserializer.class) public class EntityID { /** The index of the entity */ public final int id; /** The type of the entity */ + @JsonProperty("entityID") public final EntityType type; /** diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java index c11c4cd..b1d8bdf 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/events/Event.java @@ -1,10 +1,13 @@ package uulm.teamname.marvelous.gamelibrary.events; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import uulm.teamname.marvelous.gamelibrary.json.ingame.EventDeserializer; import uulm.teamname.marvelous.gamelibrary.json.ingame.MessageStructure; import java.util.Objects; /** Represents an abstract event sent inside a {@link MessageStructure} between client and server. */ +@JsonDeserialize(using = EventDeserializer.class) public abstract class Event { public EventType type;