From 9ae4731de4580a47132b99ae8142134ab03cc2b3 Mon Sep 17 00:00:00 2001 From: Exlll Date: Sun, 9 Jul 2017 09:45:07 +0200 Subject: [PATCH] fix postLoadHook not executed --- ConfigLib-Bukkit/src/main/resources/plugin.yml | 2 +- ConfigLib-Bungee/src/main/resources/plugin.yml | 2 +- .../src/main/java/de/exlll/configlib/Configuration.java | 1 + .../src/main/java/de/exlll/configlib/Defaultable.java | 2 +- README.md | 8 ++++---- build.gradle | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ConfigLib-Bukkit/src/main/resources/plugin.yml b/ConfigLib-Bukkit/src/main/resources/plugin.yml index 834df54..8b14e55 100644 --- a/ConfigLib-Bukkit/src/main/resources/plugin.yml +++ b/ConfigLib-Bukkit/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ConfigLib author: Exlll -version: 1.3.1 +version: 1.3.2 main: de.exlll.configlib.ConfigLib \ No newline at end of file diff --git a/ConfigLib-Bungee/src/main/resources/plugin.yml b/ConfigLib-Bungee/src/main/resources/plugin.yml index 834df54..8b14e55 100644 --- a/ConfigLib-Bungee/src/main/resources/plugin.yml +++ b/ConfigLib-Bungee/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ConfigLib author: Exlll -version: 1.3.1 +version: 1.3.2 main: de.exlll.configlib.ConfigLib \ No newline at end of file diff --git a/ConfigLib-Core/src/main/java/de/exlll/configlib/Configuration.java b/ConfigLib-Core/src/main/java/de/exlll/configlib/Configuration.java index e5dc504..893e315 100644 --- a/ConfigLib-Core/src/main/java/de/exlll/configlib/Configuration.java +++ b/ConfigLib-Core/src/main/java/de/exlll/configlib/Configuration.java @@ -49,6 +49,7 @@ public abstract class Configuration { String yaml = ConfigReader.read(configPath); Map deserializedMap = serializer.deserialize(yaml); FieldMapper.instanceFromMap(this, deserializedMap); + postLoadHook(); } /** diff --git a/ConfigLib-Core/src/main/java/de/exlll/configlib/Defaultable.java b/ConfigLib-Core/src/main/java/de/exlll/configlib/Defaultable.java index c156681..2e85d69 100644 --- a/ConfigLib-Core/src/main/java/de/exlll/configlib/Defaultable.java +++ b/ConfigLib-Core/src/main/java/de/exlll/configlib/Defaultable.java @@ -10,11 +10,11 @@ interface Defaultable { default Object fromDefault(final Object instance, Class cls) { Object newInstance = instance; if (!Reflect.isSimpleType(cls)) { - newInstance = Reflect.newInstance(cls); Reflect.checkType(instance, Map.class); Reflect.checkMapEntries((Map) instance, String.class, Object.class); @SuppressWarnings("unchecked") Map map = (Map) instance; + newInstance = Reflect.newInstance(cls); FieldMapper.instanceFromMap(newInstance, map); } Reflect.checkType(newInstance, cls); diff --git a/README.md b/README.md index 0e14cf2..3e4ae6e 100644 --- a/README.md +++ b/README.md @@ -135,14 +135,14 @@ public class ExamplePlugin extends JavaPlugin { de.exlll configlib-bukkit - 1.3.1 + 1.3.2 de.exlll configlib-bungee - 1.3.1 + 1.3.2 ``` #### Gradle @@ -154,10 +154,10 @@ repositories { } dependencies { // for Bukkit plugins - compile group: 'de.exlll', name: 'configlib-bukkit', version: '1.3.1' + compile group: 'de.exlll', name: 'configlib-bukkit', version: '1.3.2' // for Bungee plugins - compile group: 'de.exlll', name: 'configlib-bungee', version: '1.3.1' + compile group: 'de.exlll', name: 'configlib-bungee', version: '1.3.2' } ``` Additionally, you either have to import the Bukkit or BungeeCord API diff --git a/build.gradle b/build.gradle index fcd26b2..b9f6a83 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ allprojects { group 'de.exlll' - version '1.3.1' + version '1.3.2' } subprojects { apply plugin: 'java'