9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-27 19:09:19 +00:00

feat: config updater

This commit is contained in:
LoJoSho
2023-05-24 09:56:46 -05:00
parent 0b1ed0fbeb
commit 7ea4ccccef
3 changed files with 13 additions and 1 deletions

View File

@@ -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);
}