diff --git a/build.gradle.kts b/build.gradle.kts index c9921606..f2250ca0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -101,6 +101,7 @@ dependencies { implementation("com.jeff_media:SpigotUpdateChecker:3.0.0") implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT") implementation("com.ticxo:PlayerAnimator:R1.2.6") + implementation("com.github.BG-Software-LLC:CommentedConfiguration:-SNAPSHOT") //implementation("com.ticxo.playeranimator:PlayerAnimator:R1.2.5") } @@ -142,6 +143,7 @@ tasks { relocate("com.jeff_media.updatechecker", "com.hisbiscusmc.hmccosmetics.updatechecker") relocate("com.owen1212055.particlehelper", "com.hisbiscusmc.hmccosmetics.particlehelper") relocate("com.ticxo.playeranimator", "com.hisbiscusmc.hmccosmetics.playeranimator") + relocate("com.bgsoftware", "com.hisbiscusmc.hmccosmetics.configupdater") archiveFileName.set("HMCCosmeticsRemapped-${project.version}.jar") dependencies { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index d4f52858..f97b01dc 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { implementation("com.jeff_media:SpigotUpdateChecker:3.0.0") implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT") implementation("com.ticxo:PlayerAnimator:R1.2.6") + implementation("com.github.BG-Software-LLC:CommentedConfiguration:-SNAPSHOT") //implementation("com.ticxo.playeranimator:PlayerAnimator:R1.2.5") } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java index 8bf05ecc..1b29585e 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java @@ -1,5 +1,6 @@ package com.hibiscusmc.hmccosmetics; +import com.bgsoftware.common.config.CommentedConfiguration; import com.hibiscusmc.hmccosmetics.api.HMCCosmeticSetupEvent; import com.hibiscusmc.hmccosmetics.command.CosmeticCommand; import com.hibiscusmc.hmccosmetics.command.CosmeticCommandTabComplete; @@ -100,6 +101,14 @@ public final class HMCCosmeticsPlugin extends JavaPlugin { // Player Animator PlayerAnimatorImpl.initialize(this); + // Configuration Sync + final File file = Path.of(getInstance().getDataFolder().getPath(), "config.yml").toFile(); + try { + CommentedConfiguration.loadConfiguration(file).syncWithConfig(file, getInstance().getResource("config.yml"), + "database-settings", "debug-mode", "wardrobe.viewer-location", "wardrobe.npc-location", "wardrobe.wardrobe-location", "wardrobe.leave-location"); + } catch (Exception e) {} + + // Setup setup(); // Commands @@ -170,7 +179,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin { WardrobeSettings.load(loader.load().node("wardrobe")); DatabaseSettings.load(loader.load().node("database-settings")); configLoader = loader; - } catch (ConfigurateException e) { + } catch (Exception e) { throw new RuntimeException(e); }