From 1bf3ee55328237bb69459d14f2661550a35f5e2e Mon Sep 17 00:00:00 2001 From: Flo0 Date: Sun, 17 Mar 2024 07:12:57 +0100 Subject: [PATCH] Changed pom and readme --- Readme.md | 2 ++ .../ConfigurationSerializableTypeAdapter.java | 12 +++++++++++- pom.xml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 433bfa1..548b487 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,5 @@ +[![](https://jitpack.io/v/Flo0/Ambrosia.svg)](https://jitpack.io/#Flo0/Ambrosia) + # Ambrosia Ambrosia is an easy-to-use library for interacting with MongoDB. diff --git a/Spigot/src/main/java/com/gestankbratwurst/ambrosia/adapter/ConfigurationSerializableTypeAdapter.java b/Spigot/src/main/java/com/gestankbratwurst/ambrosia/adapter/ConfigurationSerializableTypeAdapter.java index 5650e5e..97be84f 100644 --- a/Spigot/src/main/java/com/gestankbratwurst/ambrosia/adapter/ConfigurationSerializableTypeAdapter.java +++ b/Spigot/src/main/java/com/gestankbratwurst/ambrosia/adapter/ConfigurationSerializableTypeAdapter.java @@ -11,6 +11,7 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization; import java.lang.reflect.Type; +import java.util.HashMap; import java.util.Map; public class ConfigurationSerializableTypeAdapter implements JsonSerializer, JsonDeserializer { @@ -27,6 +28,15 @@ public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext @Override public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context) { - return context.serialize(src.serialize()); + Map data = src.serialize(); + + Map serialized = new HashMap<>(); + + String typeAlias = ConfigurationSerialization.getAlias(src.getClass()); + serialized.put(ConfigurationSerialization.SERIALIZED_TYPE_KEY, typeAlias); + + serialized.putAll(data); + + return context.serialize(serialized); } } diff --git a/pom.xml b/pom.xml index 3ad2274..79e0b3a 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.2 + 3.4.1 package