Strip removed config options, add DisableSaving and bump config version

This commit is contained in:
Jikoo 2016-11-26 17:05:06 -05:00
parent f11d60f78c
commit 0bbcf6cdb2
2 changed files with 14 additions and 2 deletions

View file

@ -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 {

View file

@ -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);
}
/**