diff --git a/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java b/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java index 8a0229b58..cbb61ba6d 100644 --- a/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java +++ b/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java @@ -121,14 +121,20 @@ public class ConfigFileHandling { } else if (ConfigTypeConverters.convertObjects.containsKey(entry.getType())) { entry.setWithoutSaving((T) ConfigTypeConverters.convertFromString(entry.getType(), workConfig.get(entry.getNameWCategory()))); } else { - entry.setWithoutSaving((T) workConfig.get(entry.getNameWCategory())); - if (entry.isValid() == 0) return; - else if (entry.isValid() == -1) entry.setWithoutSaving(entry.getMin()); - else if (entry.isValid() == 1) entry.setWithoutSaving(entry.getMax()); + if (entry.getType() == workConfig.get(entry.getNameWCategory()).getClass()) { // If the types are the same + entry.setWithoutSaving((T) workConfig.get(entry.getNameWCategory())); + + if (entry.isValid() == 0) return; + else if (entry.isValid() == -1) entry.setWithoutSaving(entry.getMin()); + else if (entry.isValid() == 1) entry.setWithoutSaving(entry.getMax()); + } else { + ClientApi.LOGGER.warn("Entry ["+ entry.getNameWCategory() +"] is invalid. Expected " + entry.getType() + " but got " + workConfig.get(entry.getNameWCategory()).getClass() + ". Using default value."); + saveEntry(entry, workConfig); + } } } catch (Exception e) { - e.printStackTrace(); - ClientApi.LOGGER.warn("Entry ["+entry.getNameWCategory()+"] had an invalid value when loading the config"); +// e.printStackTrace(); + ClientApi.LOGGER.warn("Entry ["+entry.getNameWCategory()+"] had an invalid value when loading the config. Using default value."); saveEntry(entry, workConfig); } } else {