Auto rename plugin data folder (MinePacks -> Minepacks)

this should be only relevant for case sensitive filesystems
This commit is contained in:
GeorgH93 2017-10-23 00:09:23 +02:00
parent b6bbc7d103
commit ebce19d2d2

View File

@ -44,6 +44,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@ -82,6 +83,17 @@ public void onEnable()
return;
}
//endregion
//region check if a plugin folder exists (was renamed from MinePacks to Minepacks with the V2.0 update)
if(!getDataFolder().exists())
{
File oldPluginFolder = new File(getDataFolder().getParentFile(), "MinePacks");
if(oldPluginFolder.exists() && !oldPluginFolder.renameTo(getDataFolder()))
{
getLogger().warning("Failed to rename the plugins data-folder.\n" +
"Please rename the \"MinePacks\" folder to \"Minepacks\" and restart the server, to move your data from Minepacks V1.X to Minepacks V2.X!");
}
}
//endregion
instance = this;
config = new Config(this);
lang = new Language(this);