mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-07 11:10:14 +01:00
#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
This commit is contained in:
parent
f688eb4574
commit
f81de8a5e5
@ -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<PropertyEntry> 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");
|
||||
|
Loading…
Reference in New Issue
Block a user