From 5a00bf5fa333f3d3ce5f35491e087dc0d61e3296 Mon Sep 17 00:00:00 2001 From: Roch Blonndiaux Date: Wed, 1 Feb 2023 11:46:11 +0100 Subject: [PATCH] updater implementation --- .../src/main/java/net/Indyuce/mmoitems/api/ConfigFile.java | 1 + .../java/net/Indyuce/mmoitems/manager/ConfigManager.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/ConfigFile.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/ConfigFile.java index c09675e5..01aca381 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/ConfigFile.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/api/ConfigFile.java @@ -1,5 +1,6 @@ package net.Indyuce.mmoitems.api; +import io.lumine.mythic.lib.util.ConfigurationUpdater; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.item.ItemReference; import org.bukkit.configuration.file.FileConfiguration; diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java index 438a8f54..f65cce15 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/manager/ConfigManager.java @@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.manager; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.skill.trigger.TriggerType; +import io.lumine.mythic.lib.util.ConfigurationUpdater; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.api.ConfigFile; import net.Indyuce.mmoitems.api.ReforgeOptions; @@ -101,7 +102,6 @@ public class ConfigManager implements Reloadable { * These two steps are necessary for smooth language updates */ private void loadTranslations() { - // TODO items ConfigFile items = new ConfigFile("/language", "items"); for (ConfigItem item : ConfigItems.values) { @@ -147,6 +147,10 @@ public class ConfigManager implements Reloadable { final FileConfiguration abilities = new ConfigFile("/language", "abilities").getConfig(); for (TriggerType type : TriggerType.values()) triggerTypeNames.put(type, abilities.getString("cast-mode." + type.getLowerCaseId(), type.getName())); + + // Update language files + Arrays.asList("abilities", "attack-effects", "crafting-stations", "items", "lore-format", "messages", "potion-effects", "stats") + .forEach(s -> new ConfigurationUpdater(MMOItems.plugin.getDataFolder().toPath().resolve(String.format("language/%s.yml", s)), String.format("default/language/%s.yml", s), MMOItems.class.getClassLoader()).update()); } public void reload() {