Hopefully fix region managers not being created correctly.

This commit is contained in:
Wizjany 2011-10-04 17:43:27 -04:00
parent 810501a508
commit ecef9c9792
2 changed files with 11 additions and 5 deletions

View File

@ -149,18 +149,18 @@ public RegionManager load(World world) {
lastModified.put(name, file.lastModified());
return manager;
} catch (FileNotFoundException e) {
logger.warning("WorldGuard: Region file for world \""
} catch (FileNotFoundException e) { // this should no longer happen hopefully
logger.info("WorldGuard: Region file for world \""
+ name + "\" missing or inaccessible.");
} catch (IOException e) {
logger.warning("WorldGuard: Failed to load regions from file "
logger.info("WorldGuard: Failed to load regions from file "
+ file.getAbsolutePath() + " : " + e.getMessage());
} catch (Exception e) {
logger.warning("WorldGuard: Error loading regions for world \""
logger.info("WorldGuard: Error loading regions for world \""
+ name + "\":" + e.getMessage());
}
// @TODO: THIS CREATES PROBLEMS!!
// @TODO: THIS CREATES PROBLEMS!!one!!1!!eleven!!1!!!
return null;
}

View File

@ -51,6 +51,12 @@ public class YAMLDatabase extends AbstractProtectionDatabase {
private Map<String, ProtectedRegion> regions;
public YAMLDatabase(File file) {
if (!file.exists()) { // shouldn't be necessary, but check anyways
try {
file.createNewFile();
} catch (IOException e) {}
// if this is thrown, we can't do anything (caught elsewhere anyway)
}
config = new Configuration(file);
}