mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-11-14 15:40:49 +01:00
Fixed bug where salvage and repair configs would re-add any deleted entry that existed in the default config Fixes #5223
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
Version 2.2.045
|
Version 2.2.045
|
||||||
Fixed an error that could happen when replanting crops with Green Thumb
|
|
||||||
Green Thumb now replants harvested plants faster
|
Green Thumb now replants harvested plants faster
|
||||||
|
Fixed an error that could happen when replanting crops with Green Thumb
|
||||||
|
Fixed a bug where salvage.vanilla.yml was readding deleted entries on server restart
|
||||||
|
Fixed a bug where repair.vanilla.yml was readding deleted entries on server restart
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
The delay from a plant being replanted from Green Thumb is intentional, and while looking into bugs it seemd maybe a tad slow, so I sped it up a bit.
|
The delay from a plant being replanted from Green Thumb is intentional, and while looking into bugs it seemd maybe a tad slow, so I sped it up a bit.
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ import java.io.InputStream;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class BukkitConfig {
|
public abstract class BukkitConfig {
|
||||||
boolean copyDefaults = true;
|
boolean copyDefaults;
|
||||||
protected final String fileName;
|
protected final String fileName;
|
||||||
protected final File configFile;
|
protected final File configFile;
|
||||||
protected YamlConfiguration defaultYamlConfig;
|
protected YamlConfiguration defaultYamlConfig;
|
||||||
@@ -58,7 +59,7 @@ public abstract class BukkitConfig {
|
|||||||
savedDefaults = true;
|
savedDefaults = true;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
mcMMO.p.getLogger().log(Level.SEVERE, "Unable to save config file: " + fileName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class RepairConfigManager {
|
|||||||
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
|
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
|
||||||
File dataFolder = plugin.getDataFolder();
|
File dataFolder = plugin.getDataFolder();
|
||||||
|
|
||||||
RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML, true);
|
RepairConfig mainRepairConfig = new RepairConfig(REPAIR_VANILLA_YML, false);
|
||||||
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
private final HashSet<String> notSupported;
|
private final HashSet<String> notSupported;
|
||||||
private Set<Salvageable> salvageables;
|
private Set<Salvageable> salvageables;
|
||||||
|
|
||||||
public SalvageConfig(String fileName, boolean copyDefaults) {
|
public SalvageConfig(String fileName) {
|
||||||
super(fileName, copyDefaults);
|
super(fileName, false);
|
||||||
notSupported = new HashSet<>();
|
notSupported = new HashSet<>();
|
||||||
loadKeys();
|
loadKeys();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class SalvageConfigManager {
|
|||||||
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
||||||
File dataFolder = plugin.getDataFolder();
|
File dataFolder = plugin.getDataFolder();
|
||||||
|
|
||||||
SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML, true);
|
SalvageConfig mainSalvageConfig = new SalvageConfig(SALVAGE_VANILLA_YML);
|
||||||
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
@@ -34,7 +34,7 @@ public class SalvageConfigManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SalvageConfig salvageConfig = new SalvageConfig(fileName, false);
|
SalvageConfig salvageConfig = new SalvageConfig(fileName);
|
||||||
salvageables.addAll(salvageConfig.getLoadedSalvageables());
|
salvageables.addAll(salvageConfig.getLoadedSalvageables());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user