Skip to content

Commit

Permalink
Changed pom and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo0 committed Mar 17, 2024
1 parent 32fb6a7 commit 1bf3ee5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends ConfigurationSerializable> implements JsonSerializer<T>, JsonDeserializer<T> {
Expand All @@ -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<String, Object> data = src.serialize();

Map<String, Object> serialized = new HashMap<>();

String typeAlias = ConfigurationSerialization.getAlias(src.getClass());
serialized.put(ConfigurationSerialization.SERIALIZED_TYPE_KEY, typeAlias);

serialized.putAll(data);

return context.serialize(serialized);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
Expand Down

0 comments on commit 1bf3ee5

Please sign in to comment.