mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fix convert
This commit is contained in:
parent
48382e0c4e
commit
0114dd7558
@ -1840,13 +1840,13 @@ public class PS {
|
|||||||
/**
|
/**
|
||||||
* Setup the default configuration (settings.yml)
|
* Setup the default configuration (settings.yml)
|
||||||
*/
|
*/
|
||||||
public void setupConfig() {
|
public void setupConfig() throws IOException {
|
||||||
String lastVersionString = this.config.getString("version");
|
String lastVersionString = this.config.getString("version");
|
||||||
if (lastVersionString != null) {
|
if (lastVersionString != null) {
|
||||||
String[] split = lastVersionString.split("\\.");
|
String[] split = lastVersionString.split("\\.");
|
||||||
this.lastVersion = new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])};
|
this.lastVersion = new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])};
|
||||||
}
|
}
|
||||||
if (checkVersion(new int[]{3,4,0}, version)) {
|
if (checkVersion(lastVersion, new int[]{3,4,0})) {
|
||||||
Settings.convertLegacy(configFile);
|
Settings.convertLegacy(configFile);
|
||||||
if (config.contains("worlds")) {
|
if (config.contains("worlds")) {
|
||||||
ConfigurationSection worldSection = config.getConfigurationSection("worlds");
|
ConfigurationSection worldSection = config.getConfigurationSection("worlds");
|
||||||
@ -1878,6 +1878,15 @@ public class PS {
|
|||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
PS.log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually.");
|
PS.log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
this.worldsFile = new File(folder,"worlds.yml");
|
||||||
|
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
||||||
|
PS.log("Could not create the worlds file, please create \"worlds.yml\" manually.");
|
||||||
|
}
|
||||||
|
this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile);
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
PS.log("Failed to save settings.yml");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
this.configFile = new File(folder,"settings.yml");
|
this.configFile = new File(folder,"settings.yml");
|
||||||
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
||||||
@ -1904,15 +1913,6 @@ public class PS {
|
|||||||
err.printStackTrace();
|
err.printStackTrace();
|
||||||
PS.log("failed to save style.yml");
|
PS.log("failed to save style.yml");
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
this.worldsFile = new File(folder,"worlds.yml");
|
|
||||||
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
|
||||||
PS.log("Could not create the worlds file, please create \"worlds.yml\" manually.");
|
|
||||||
}
|
|
||||||
this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile);
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
PS.log("Failed to save settings.yml");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
this.storageFile = new File(folder,"storage.yml");
|
this.storageFile = new File(folder,"storage.yml");
|
||||||
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
||||||
|
@ -29,7 +29,7 @@ public class Settings extends Config {
|
|||||||
public static boolean TITLES = true;
|
public static boolean TITLES = true;
|
||||||
|
|
||||||
@Create // This value will be generated automatically
|
@Create // This value will be generated automatically
|
||||||
public static final ConfigBlock<AUTO_CLEAR> AUTO_CLEAR = null; // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks
|
public static ConfigBlock<AUTO_CLEAR> AUTO_CLEAR = null; // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks
|
||||||
|
|
||||||
@Comment("This is an auto clearing task called `task1`")
|
@Comment("This is an auto clearing task called `task1`")
|
||||||
@BlockName("task1") // The name for the default block
|
@BlockName("task1") // The name for the default block
|
||||||
@ -236,7 +236,7 @@ public class Settings extends Config {
|
|||||||
ENABLED_COMPONENTS.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", ENABLED_COMPONENTS.PLOT_EXPIRY);
|
ENABLED_COMPONENTS.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", ENABLED_COMPONENTS.PLOT_EXPIRY);
|
||||||
if (ENABLED_COMPONENTS.PLOT_EXPIRY) {
|
if (ENABLED_COMPONENTS.PLOT_EXPIRY) {
|
||||||
ENABLED_COMPONENTS.BAN_DELETER = config.getBoolean("clear.on.ban");
|
ENABLED_COMPONENTS.BAN_DELETER = config.getBoolean("clear.on.ban");
|
||||||
|
AUTO_CLEAR = new ConfigBlock<>();
|
||||||
AUTO_CLEAR.put("task1", new AUTO_CLEAR());
|
AUTO_CLEAR.put("task1", new AUTO_CLEAR());
|
||||||
AUTO_CLEAR task = AUTO_CLEAR.get("task1");
|
AUTO_CLEAR task = AUTO_CLEAR.get("task1");
|
||||||
task.CALIBRATION = new AUTO_CLEAR.CALIBRATION();
|
task.CALIBRATION = new AUTO_CLEAR.CALIBRATION();
|
||||||
|
Loading…
Reference in New Issue
Block a user