plugin: handle failure to load more gracefully

This commit is contained in:
Torrie Fischer 2022-09-18 15:01:14 +02:00
parent d247953546
commit 244bb32d70

View File

@ -111,7 +111,11 @@ public class Plugin extends JavaPlugin {
this.getDataFolder().mkdir(); this.getDataFolder().mkdir();
File regionConfigFile = new File(this.getDataFolder(), "regions.yml"); File regionConfigFile = new File(this.getDataFolder(), "regions.yml");
Configuration regionConf = YamlConfiguration.loadConfiguration(regionConfigFile); Configuration regionConf = YamlConfiguration.loadConfiguration(regionConfigFile);
try {
m_regions.loadRegions(regionConf); m_regions.loadRegions(regionConf);
} catch (Exception e) {
log.log(Level.SEVERE, "Could not load regions config! You risk overwriting and losing data!", e);
}
} }
public void saveRegions() { public void saveRegions() {