feat: added exception if a deserialized character is non-existent

This commit is contained in:
Yannik Bretschneider 2021-06-02 16:29:48 +02:00
parent e54ce32626
commit 19f6695ba8

View File

@ -6,8 +6,8 @@ import com.fasterxml.jackson.databind.*;
import uulm.teamname.marvelous.gamelibrary.IntVector2;
import uulm.teamname.marvelous.gamelibrary.entities.*;
import uulm.teamname.marvelous.gamelibrary.entities.Character;
import uulm.teamname.marvelous.gamelibrary.json.config.CharacterConfig;
import uulm.teamname.marvelous.gamelibrary.json.config.CharacterProperties;
import uulm.teamname.marvelous.gamelibrary.config.CharacterConfig;
import uulm.teamname.marvelous.gamelibrary.config.CharacterProperties;
import uulm.teamname.marvelous.gamelibrary.json.ingame.SerializedEntityType;
import java.io.IOException;
@ -37,6 +37,8 @@ public class EntityDeserializer extends JsonDeserializer<Entity> {
CharacterProperties properties = config.getMap().get(characterName);
if (properties == null) throw new IOException("Non-existent Character in Event");
result = new Character(
id,
codec.treeToValue(node.get("position"), IntVector2.class),