mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-25 09:41:23 +01:00
Do not migrate if new config file is created
This commit is contained in:
parent
1e9f19b01f
commit
1b2f8889ce
@ -34,15 +34,21 @@ abstract class FileConfigHandle<C extends FileConfiguration> extends GenericConf
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean load() {
|
public boolean load() {
|
||||||
if (!createConfigFile()) {
|
boolean newFileCreated;
|
||||||
|
try {
|
||||||
|
newFileCreated = createConfigFile();
|
||||||
|
} catch (IOException e) {
|
||||||
Logging.severe("Failed to create config file: %s", configFile.getName());
|
Logging.severe("Failed to create config file: %s", configFile.getName());
|
||||||
|
Logging.severe(e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!loadConfigObject()) {
|
if (!loadConfigObject()) {
|
||||||
Logging.severe("Failed to load config file: %s", configFile.getName());
|
Logging.severe("Failed to load config file: %s", configFile.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
migrateConfig();
|
if (!newFileCreated) {
|
||||||
|
migrateConfig();
|
||||||
|
}
|
||||||
setUpNodes();
|
setUpNodes();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -52,19 +58,11 @@ abstract class FileConfigHandle<C extends FileConfiguration> extends GenericConf
|
|||||||
*
|
*
|
||||||
* @return True if file exist or created successfully, otherwise false.
|
* @return True if file exist or created successfully, otherwise false.
|
||||||
*/
|
*/
|
||||||
protected boolean createConfigFile() {
|
protected boolean createConfigFile() throws IOException {
|
||||||
if (configFile.exists()) {
|
if (configFile.exists()) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (!configFile.createNewFile()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Logging.info("Created new config file: %s", configFile.getName());
|
|
||||||
} catch (IOException e) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return configFile.createNewFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user