Strip removed config options, add DisableSaving and bump config version
This commit is contained in:
@@ -12,7 +12,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
|
|
||||||
public class ConfigUpdater {
|
public class ConfigUpdater {
|
||||||
|
|
||||||
private static final int CONFIG_VERSION = 2;
|
private static final int CONFIG_VERSION = 3;
|
||||||
|
|
||||||
private final OpenInv plugin;
|
private final OpenInv plugin;
|
||||||
|
|
||||||
@@ -41,10 +41,22 @@ public class ConfigUpdater {
|
|||||||
switch (getConfigVersion()) {
|
switch (getConfigVersion()) {
|
||||||
case 1:
|
case 1:
|
||||||
updateConfig1To2();
|
updateConfig1To2();
|
||||||
|
case 2:
|
||||||
|
updateConfig2To3();
|
||||||
break;
|
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() {
|
private void updateConfig1To2() {
|
||||||
// Backup the old config file
|
// Backup the old config file
|
||||||
try {
|
try {
|
||||||
|
@@ -225,7 +225,7 @@ public class OpenInv extends JavaPlugin {
|
|||||||
* @return false unless configured otherwise
|
* @return false unless configured otherwise
|
||||||
*/
|
*/
|
||||||
public boolean disableSaving() {
|
public boolean disableSaving() {
|
||||||
return getConfig().getBoolean("DisableSaving", false);
|
return getConfig().getBoolean("settings.disable-saving", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user