Advanced-Portals/src/main/java/com/sekwah/advancedportals/bukkit/config/ConfigHelper.java

46 lines
1.6 KiB
Java
Raw Normal View History

2020-06-18 04:37:06 +02:00
package com.sekwah.advancedportals.bukkit.config;
import org.bukkit.configuration.file.FileConfiguration;
public class ConfigHelper {
public static final String CONFIG_VERSION = "ConfigVersion";
2020-06-18 04:37:06 +02:00
public static final String COMMAND_LOGS = "CommandLogs";
public static final String FORCE_ENABLE_PROXY_SUPPORT = "ForceEnableProxySupport";
public static final String DISABLE_PROXY_WARNING = "DisableProxyWarning";
2021-01-24 04:05:58 +01:00
public static final String PROXY_TELEPORT_DELAY = "ProxyTeleportDelay";
public static final String DISABLE_GATEWAY_BEAM = "DisableGatewayBeam";
2020-06-21 03:49:18 +02:00
2021-01-24 04:08:14 +01:00
private final FileConfiguration config;
2020-06-18 04:37:06 +02:00
public ConfigHelper(FileConfiguration config) {
this.config = config;
}
2020-06-18 04:40:10 +02:00
/**
* Recursively for each time there is a future update
*/
2020-06-18 04:37:06 +02:00
public void update() {
String configVersion = config.getString(CONFIG_VERSION);
2020-06-18 04:40:10 +02:00
// Added in 0.5.4
if(configVersion == null || configVersion.equals("true") || configVersion.equals("0.5.3")) {
2020-06-18 04:40:10 +02:00
config.set(ConfigHelper.CONFIG_VERSION, "0.5.4");
2020-06-21 03:49:18 +02:00
config.set(ConfigHelper.DISABLE_GATEWAY_BEAM, true);
update();
} else if(configVersion.equals("0.5.4")) {
config.set(ConfigHelper.CONFIG_VERSION, "0.5.11");
config.set(ConfigHelper.COMMAND_LOGS, true);
update();
2021-01-24 04:05:58 +01:00
} else if(configVersion.equals("0.5.10") || configVersion.equals("0.5.11")) {
config.set(ConfigHelper.CONFIG_VERSION, "0.5.13");
config.set(ConfigHelper.FORCE_ENABLE_PROXY_SUPPORT, false);
config.set(ConfigHelper.PROXY_TELEPORT_DELAY, 0);
2020-06-18 04:37:06 +02:00
}
}
}