Skip to content

Commit

Permalink
Merge branch 'master' of github.com:FoxDenStudio/FoxGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityfox committed Jan 19, 2016
2 parents 9ee256c + 66c3d8b commit 1be09d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1be09d6

Please sign in to comment.