Catch CraftItemStack when de/serializing, fixes #414

This commit is contained in:
libraryaddict 2019-12-21 19:12:22 +13:00
parent f130d55170
commit 3b3de8d0ee
2 changed files with 7 additions and 13 deletions

View File

@ -811,14 +811,16 @@ public class DisguiseUtilities {
}
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(MetaIndex.class, new SerializerMetaIndex());
gsonBuilder.registerTypeAdapter(WrappedGameProfile.class, new SerializerGameProfile());
gsonBuilder.registerTypeAdapter(WrappedBlockData.class, new SerializerWrappedBlockData());
gsonBuilder.registerTypeAdapter(Disguise.class, new SerializerDisguise());
gsonBuilder.registerTypeAdapter(FlagWatcher.class, new SerializerFlagWatcher());
gsonBuilder.registerTypeAdapter(WrappedChatComponent.class, new SerializerChatComponent());
gsonBuilder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
gsonBuilder.registerTypeAdapter(ItemStack.class, new SerializerItemStack());
gsonBuilder.registerTypeHierarchyAdapter(ItemStack.class, new SerializerItemStack());
gsonBuilder.registerTypeAdapter(FlagWatcher.class, new SerializerFlagWatcher(gsonBuilder.create()));
gsonBuilder.registerTypeAdapter(Disguise.class, new SerializerDisguise());
gson = gsonBuilder.create();

View File

@ -27,16 +27,8 @@ public class SerializerFlagWatcher implements JsonDeserializer<FlagWatcher>, Jso
InstanceCreator<FlagWatcher> {
private Gson gson;
public SerializerFlagWatcher() {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(MetaIndex.class, new SerializerMetaIndex());
gsonBuilder.registerTypeAdapter(WrappedGameProfile.class, new SerializerGameProfile());
gsonBuilder.registerTypeAdapter(WrappedBlockData.class, new SerializerWrappedBlockData());
gsonBuilder.registerTypeAdapter(WrappedChatComponent.class, new SerializerChatComponent());
gsonBuilder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
gsonBuilder.registerTypeAdapter(ItemStack.class, new SerializerItemStack());
gson = gsonBuilder.create();
public SerializerFlagWatcher(Gson gson) {
this.gson = gson;
}
@Override