From 8416fafa4517e02a87bf4ef296d398240f9cf4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Lystb=C3=A6k?= Date: Mon, 11 Mar 2024 01:23:04 +0100 Subject: [PATCH] Fix an issue where config.yml was now being overwritten... --- pom.xml | 2 +- .../legacychatfix/config/ConfigManager.java | 25 ------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 65e4dc5..f139b00 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ eu.mathiasl LegacyChatFix - 0.5-SNAPSHOT + 0.5.1-SNAPSHOT jar LegacyChatFix diff --git a/src/main/java/eu/mathiasl/legacychatfix/config/ConfigManager.java b/src/main/java/eu/mathiasl/legacychatfix/config/ConfigManager.java index 810bc9e..cf3ce08 100644 --- a/src/main/java/eu/mathiasl/legacychatfix/config/ConfigManager.java +++ b/src/main/java/eu/mathiasl/legacychatfix/config/ConfigManager.java @@ -70,30 +70,5 @@ public class ConfigManager { plugin.saveResource(configName, false); return; } - - FileConfiguration config = YamlConfiguration.loadConfiguration(configFile); - String configVersion = config.getString("ConfigVersion", "0"); // Default to "0" if not found - if (!"1.0".equals(configVersion)) { - backupAndReplaceConfig(configName); - - // After backing up and copying new ones, you might want to reload these configs into your ConfigManager - // assuming you have such a method in your ConfigManager - reloadConfig(configName); - } - } - - private void backupAndReplaceConfig(String fileName) { - File configFile = new File(plugin.getDataFolder(), fileName); - File backupFile = new File(plugin.getDataFolder(), fileName + ".BACKUP"); - - // Backup the old file - try { - Files.move(configFile.toPath(), backupFile.toPath()); - } catch (IOException e) { - plugin.getLogger().warning("Could not backup " + fileName + ": " + e.getMessage()); - } - - // Copy new file from resources - plugin.saveResource(fileName, false); } }