From 90897c9ae115c7519eb601c191923b5e1fca9daf Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 28 Sep 2019 17:58:02 -0700 Subject: [PATCH] I'll probably end up rewriting these serializers --- src/main/java/com/gmail/nossr50/config/ConfigManager.java | 3 ++- .../hocon/serializers/CustomItemTargetSerializer.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index 599ddfcdb..c6a065b00 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -261,6 +261,8 @@ public final class ConfigManager { customSerializers.registerType(new TypeToken() {}, new CustomEnumValueSerializer()); customSerializers.registerType(new TypeToken>() {}, new ItemStackSerializer()); customSerializers.registerType(new TypeToken>() {}, new SetSerializer()); + + customSerializers.registerType(new TypeToken>() {}, new CustomItemTargetSerializer()); customSerializers.registerType(new TypeToken() {}, new SimpleRepairCostSerializer()); customSerializers.registerType(TypeToken.of(TamingSummon.class), new TamingSummonSerializer()); @@ -274,7 +276,6 @@ public final class ConfigManager { customSerializers.registerType(TypeToken.of(PlayerNotificationSettings.class), new PlayerNotificationSerializer()); customSerializers.registerType(TypeToken.of(SoundSetting.class), new SoundSettingSerializer()); customSerializers.registerType(TypeToken.of(ItemWildcards.class), new ItemWildcardSerializer()); - customSerializers.registerType(TypeToken.of(ItemMatch.class), new CustomItemTargetSerializer()); customSerializers.registerType(TypeToken.of(RepairTransaction.class), new RepairTransactionSerializer()); customSerializers.registerType(TypeToken.of(RawNBT.class), new RawNBTSerializer()); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomItemTargetSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomItemTargetSerializer.java index 218e112d5..7e059756e 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomItemTargetSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/serializers/CustomItemTargetSerializer.java @@ -13,9 +13,9 @@ import org.checkerframework.checker.nullness.qual.Nullable; import java.util.HashSet; -public class CustomItemTargetSerializer implements TypeSerializer { +public class CustomItemTargetSerializer implements TypeSerializer> { - private static final String ITEM_CONSUMED_FOR_REPAIR = "Item-Consumed-For-Repair"; + private static final String ITEM_CONSUMED_FOR_REPAIR = "Target-Item"; private static final String NBT_REQUIREMENTS = "NBT-Requirements"; @Nullable @@ -32,7 +32,7 @@ public class CustomItemTargetSerializer implements TypeSerializer { } @Override - public void serialize(@NonNull TypeToken type, @Nullable ItemMatch obj, @NonNull ConfigurationNode value) throws ObjectMappingException { + public void serialize(@NonNull TypeToken type, @Nullable ItemMatch obj, @NonNull ConfigurationNode value) throws ObjectMappingException { value.getNode(ITEM_CONSUMED_FOR_REPAIR).setValue(obj.getItem()); if(obj.getItemMatchProperties().size() > 0) {