From f0636ef47e6e384864be52ad52b5fd0f5fe6372a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 24 Sep 2019 14:42:13 -0700 Subject: [PATCH] More fixes for serializers --- src/main/java/com/gmail/nossr50/config/ConfigManager.java | 2 +- .../nossr50/config/hocon/serializers/ItemStackSerializer.java | 2 +- .../config/hocon/serializers/RepairCostSerializer.java | 1 + .../config/hocon/serializers/SkillRankPropertySerializer.java | 2 +- src/main/java/com/gmail/nossr50/mcMMO.java | 2 +- src/main/java/com/gmail/nossr50/util/CompatibilityCheck.java | 4 +++- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index 3f10dbb64..20f81376d 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -288,7 +288,7 @@ public final class ConfigManager { } private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz) { - skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz)); + skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(pluginRef, primarySkillType, clazz)); } /** diff --git a/src/main/java/com/gmail/nossr50/config/hocon/serializers/ItemStackSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/serializers/ItemStackSerializer.java index fce3f6845..eb0ae8d74 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/serializers/ItemStackSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/serializers/ItemStackSerializer.java @@ -24,7 +24,7 @@ public class ItemStackSerializer implements TypeSerializer> { Material itemMatch = Material.matchMaterial(itemIdentifier); if(itemMatch == null) { - pluginRef.getLogger().info("Could not find a match for "+itemIdentifier); + System.out.println("[mcMMO Deserializer Debug] Could not find a match for "+itemIdentifier); return null; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/serializers/RepairCostSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/serializers/RepairCostSerializer.java index b218d7300..bcab574a5 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/serializers/RepairCostSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/serializers/RepairCostSerializer.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.skills.repair.SimpleRepairCost; import com.google.common.reflect.TypeToken; import ninja.leaping.configurate.ConfigurationNode; import ninja.leaping.configurate.objectmapping.ObjectMappingException; +import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/src/main/java/com/gmail/nossr50/config/hocon/serializers/SkillRankPropertySerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/serializers/SkillRankPropertySerializer.java index 53c170f7e..933984043 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/serializers/SkillRankPropertySerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/serializers/SkillRankPropertySerializer.java @@ -30,7 +30,7 @@ public class SkillRankPropertySerializer implements TypeSerializer(retroMap); } catch (ObjectMappingException e) { - pluginRef.getLogger().severe("Unable to deserialize rank property information from the config, make sure the ranks are correctly set in the config. You can delete the rank config to generate a new one if problems persist."); + System.out.println("[mcMMO Deserializer Debug] Unable to deserialize rank property information from the config, make sure the ranks are correctly set in the config. You can delete the rank config to generate a new one if problems persist."); throw e; } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index b1af4e849..8499ba58c 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -166,7 +166,7 @@ public class mcMMO extends JavaPlugin { databaseManager = getDatabaseManagerFactory().getDatabaseManager(); //Check for the newer API and tell them what to do if its missing - CompatibilityCheck.checkForOutdatedAPI(serverAPIOutdated, getServerSoftwareStr()); + CompatibilityCheck.checkForOutdatedAPI(this, serverAPIOutdated, getServerSoftwareStr()); if (serverAPIOutdated) { Bukkit diff --git a/src/main/java/com/gmail/nossr50/util/CompatibilityCheck.java b/src/main/java/com/gmail/nossr50/util/CompatibilityCheck.java index cbb180cc9..8367194ae 100644 --- a/src/main/java/com/gmail/nossr50/util/CompatibilityCheck.java +++ b/src/main/java/com/gmail/nossr50/util/CompatibilityCheck.java @@ -1,12 +1,14 @@ package com.gmail.nossr50.util; +import com.gmail.nossr50.mcMMO; + import java.lang.reflect.Method; public class CompatibilityCheck { /** * Uses reflection to check for incompatible server software */ - public static void checkForOutdatedAPI(boolean serverAPIOutdated, String software) { + public static void checkForOutdatedAPI(mcMMO pluginRef, boolean serverAPIOutdated, String software) { try { Class checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent"); Method newerAPIMethod = checkForClass.getMethod("getItems");