From 338ac636119813835e318754f8b22637b27f20a4 Mon Sep 17 00:00:00 2001 From: Archy-X Date: Fri, 8 Sep 2023 20:42:30 -0400 Subject: [PATCH] Remove automatic loot file updating --- .../aureliumskills/loot/LootTableManager.java | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/bukkit/src/main/java/com/archyx/aureliumskills/loot/LootTableManager.java b/bukkit/src/main/java/com/archyx/aureliumskills/loot/LootTableManager.java index 524fc2c86..d2937a265 100644 --- a/bukkit/src/main/java/com/archyx/aureliumskills/loot/LootTableManager.java +++ b/bukkit/src/main/java/com/archyx/aureliumskills/loot/LootTableManager.java @@ -6,15 +6,12 @@ import com.archyx.lootmanager.LootManager; import com.archyx.lootmanager.loot.LootPool; import com.archyx.lootmanager.loot.LootTable; -import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; @@ -82,7 +79,6 @@ public void loadLootTables() { if (skill == null) return; FileConfiguration config = YamlConfiguration.loadConfiguration(lootTableFile); - matchConfig(config, lootTableFile); // Try to update file // Load corresponding loot table type LootTable lootTable = lootManager.getLootLoader().loadLootTable(lootTableFile, config); if (lootTable != null) { @@ -107,32 +103,5 @@ public void loadLootTables() { public LootTable getLootTable(Skill skill) { return lootTables.get(skill); } - - public void matchConfig(FileConfiguration config, File file) { - config.options().copyDefaults(true); - try { - boolean changesMade = false; - InputStream is = plugin.getResource("loot/" + file.getName()); - if (is != null) { - YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(is)); - ConfigurationSection configurationSection = defConfig.getConfigurationSection(""); - if (configurationSection != null) { - for (String key : configurationSection.getKeys(true)) { - if (!config.contains(key)) { - config.set(key, defConfig.get(key)); - if (!changesMade) { - changesMade = true; - } - } - } - if (changesMade) { - config.save(file); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } }