fix yaml/json schema migration

This commit is contained in:
Luck 2017-04-12 21:33:59 +01:00
parent be2a8b7b07
commit c82d028429
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -119,11 +119,13 @@ public abstract class FlatfileBacking extends AbstractBacking {
private void setupFiles() throws IOException {
File data = new File(pluginDir, dataFolderName);
data.mkdirs();
// Perform schema migration
// Try to perform schema migration
File oldData = new File(pluginDir, "data");
if (!data.exists() && oldData.exists()) {
data.mkdirs();
plugin.getLog().severe("===== Legacy Schema Migration =====");
plugin.getLog().severe("Starting migration from legacy schema. This could take a while....");
plugin.getLog().severe("Please do not stop your server while the migration takes place.");
@ -141,6 +143,8 @@ public abstract class FlatfileBacking extends AbstractBacking {
e.printStackTrace();
}
}
} else {
data.mkdirs();
}
usersDir = new File(data, "users");