From ecef9c9792926e32e94bc70f43934b93c20cc2b4 Mon Sep 17 00:00:00 2001 From: Wizjany Date: Tue, 4 Oct 2011 17:43:27 -0400 Subject: [PATCH] Hopefully fix region managers not being created correctly. --- .../worldguard/protection/GlobalRegionManager.java | 10 +++++----- .../worldguard/protection/databases/YAMLDatabase.java | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java b/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java index 4b0b5e5d..f2690102 100644 --- a/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java +++ b/src/main/java/com/sk89q/worldguard/protection/GlobalRegionManager.java @@ -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; } diff --git a/src/main/java/com/sk89q/worldguard/protection/databases/YAMLDatabase.java b/src/main/java/com/sk89q/worldguard/protection/databases/YAMLDatabase.java index 42e0d474..eae3506e 100644 --- a/src/main/java/com/sk89q/worldguard/protection/databases/YAMLDatabase.java +++ b/src/main/java/com/sk89q/worldguard/protection/databases/YAMLDatabase.java @@ -51,6 +51,12 @@ public class YAMLDatabase extends AbstractProtectionDatabase { private Map 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); }