diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGManager.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGManager.java index b66a83d..71fc524 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGManager.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGManager.java @@ -90,7 +90,7 @@ public boolean isRegistered(IHandler handler) { return handlers.contains(handler); } - public boolean addRegion(World world, IRegion region) { + public boolean addRegion(World world, IRegion region, boolean update) { if (region == null) return false; if (region.getWorld() != null || getRegion(world, region.getName()) != null) return false; region.setWorld(world); @@ -108,10 +108,14 @@ public Cause getCause() { } }); FGStorageManager.getInstance().unmarkForDeletion(region); - FGStorageManager.getInstance().updateRegion(region); + if (update) FGStorageManager.getInstance().updateRegion(region); return true; } + public boolean addRegion(World world, IRegion region) { + return addRegion(world, region, true); + } + public IRegion getRegion(World world, String name) { for (IRegion region : this.regions.get(world)) { if (region.getName().equalsIgnoreCase(name)) { @@ -312,7 +316,7 @@ public void populateWorld(World world) { this.createLists(world); GlobalRegion gr = new GlobalRegion(); gr.addHandler(this.globalHandler); - addRegion(world, gr); + addRegion(world, gr, false); } public void unloadWorld(World world) { diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FoxGuardMain.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FoxGuardMain.java index 9bc1de5..1bfca54 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FoxGuardMain.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FoxGuardMain.java @@ -211,10 +211,10 @@ public void worldUnload(UnloadWorldEvent event) { @Listener public void worldLoad(LoadWorldEvent event) { - logger.info("Constructing Regions for World: \"" + event.getTargetWorld().getName() + "\""); - FGManager.getInstance().populateWorld(event.getTargetWorld()); logger.info("Initializing Regions database for World: \"" + event.getTargetWorld().getName() + "\""); FGStorageManager.getInstance().initWorld(event.getTargetWorld()); + logger.info("Constructing Regions for World: \"" + event.getTargetWorld().getName() + "\""); + FGManager.getInstance().populateWorld(event.getTargetWorld()); logger.info("Loading Regions for World: \"" + event.getTargetWorld().getName() + "\""); FGStorageManager.getInstance().loadWorldRegions(event.getTargetWorld()); if (loaded) {