mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Strip removed config options, add DisableSaving and bump config version
This commit is contained in:
parent
f11d60f78c
commit
0bbcf6cdb2
2 changed files with 14 additions and 2 deletions
|
@ -12,7 +12,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||
|
||||
public class ConfigUpdater {
|
||||
|
||||
private static final int CONFIG_VERSION = 2;
|
||||
private static final int CONFIG_VERSION = 3;
|
||||
|
||||
private final OpenInv plugin;
|
||||
|
||||
|
@ -41,10 +41,22 @@ public class ConfigUpdater {
|
|||
switch (getConfigVersion()) {
|
||||
case 1:
|
||||
updateConfig1To2();
|
||||
case 2:
|
||||
updateConfig2To3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig2To3() {
|
||||
plugin.getConfig().set("config-version", 3);
|
||||
plugin.getConfig().set("items.open-inv", null);
|
||||
plugin.getConfig().set("toggles.items.open-inv", null);
|
||||
plugin.getConfig().set("settings.disable-saving", plugin.getConfig().getBoolean("DisableSaving", false));
|
||||
plugin.getConfig().set("DisableSaving", null);
|
||||
// Save the new config
|
||||
plugin.saveConfig();
|
||||
}
|
||||
|
||||
private void updateConfig1To2() {
|
||||
// Backup the old config file
|
||||
try {
|
||||
|
|
|
@ -225,7 +225,7 @@ public class OpenInv extends JavaPlugin {
|
|||
* @return false unless configured otherwise
|
||||
*/
|
||||
public boolean disableSaving() {
|
||||
return getConfig().getBoolean("DisableSaving", false);
|
||||
return getConfig().getBoolean("settings.disable-saving", false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue