More fixes for serializers

This commit is contained in:
nossr50 2019-09-24 14:42:13 -07:00
parent 68f6fea66a
commit f0636ef47e
6 changed files with 8 additions and 5 deletions

View File

@ -288,7 +288,7 @@ public final class ConfigManager {
} }
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz) { private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz) {
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz)); skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(pluginRef, primarySkillType, clazz));
} }
/** /**

View File

@ -24,7 +24,7 @@ public class ItemStackSerializer implements TypeSerializer<MMOItem<?>> {
Material itemMatch = Material.matchMaterial(itemIdentifier); Material itemMatch = Material.matchMaterial(itemIdentifier);
if(itemMatch == null) { 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; return null;
} }

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.skills.repair.SimpleRepairCost;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import ninja.leaping.configurate.ConfigurationNode; import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException; 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.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;

View File

@ -30,7 +30,7 @@ public class SkillRankPropertySerializer implements TypeSerializer<SkillRankProp
retroHashMap = new HashMap<>(retroMap); retroHashMap = new HashMap<>(retroMap);
} catch (ObjectMappingException e) { } 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; throw e;
} }

View File

@ -166,7 +166,7 @@ public class mcMMO extends JavaPlugin {
databaseManager = getDatabaseManagerFactory().getDatabaseManager(); databaseManager = getDatabaseManagerFactory().getDatabaseManager();
//Check for the newer API and tell them what to do if its missing //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) { if (serverAPIOutdated) {
Bukkit Bukkit

View File

@ -1,12 +1,14 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import com.gmail.nossr50.mcMMO;
import java.lang.reflect.Method; import java.lang.reflect.Method;
public class CompatibilityCheck { public class CompatibilityCheck {
/** /**
* Uses reflection to check for incompatible server software * 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 { try {
Class<?> checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent"); Class<?> checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent");
Method newerAPIMethod = checkForClass.getMethod("getItems"); Method newerAPIMethod = checkForClass.getMethod("getItems");