From f81de8a5e5eb8b083d0f10df4c0dff8f97130145 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Mon, 19 Sep 2016 18:02:39 +0200 Subject: [PATCH] #952 Fix settings initialization when config.yml does not exist yet - Need to copy the file from the JAR if it doesn't exist before attempting to open it --- src/main/java/fr/xephi/authme/initialization/Initializer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/initialization/Initializer.java b/src/main/java/fr/xephi/authme/initialization/Initializer.java index 4f6d7ac91..9aaba7990 100644 --- a/src/main/java/fr/xephi/authme/initialization/Initializer.java +++ b/src/main/java/fr/xephi/authme/initialization/Initializer.java @@ -62,12 +62,12 @@ public class Initializer { * @return the settings instance, or null if it could not be constructed */ public static Settings createSettings(AuthMe authMe) throws Exception { - File configFile = new File(authMe.getDataFolder(), "config.yml"); - PropertyResource resource = new YamlFileResource(configFile); SettingsMigrationService migrationService = new SettingsMigrationService(authMe.getDataFolder()); List knownProperties = AuthMeSettingsRetriever.getAllPropertyFields(); + File configFile = new File(authMe.getDataFolder(), "config.yml"); if (FileUtils.copyFileFromResource(configFile, "config.yml")) { + PropertyResource resource = new YamlFileResource(configFile); return new Settings(authMe.getDataFolder(), resource, migrationService, knownProperties); } throw new Exception("Could not copy config.yml from JAR to plugin folder");