From c82d028429d2f1c4f930fa8c92e3fcce86ea76eb Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 12 Apr 2017 21:33:59 +0100 Subject: [PATCH] fix yaml/json schema migration --- .../luckperms/common/storage/backing/FlatfileBacking.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java index 1ef7790c..0700664e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/FlatfileBacking.java @@ -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");