Skip to content

Commit

Permalink
Fix the default flagProfiles settings, fix migration issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
NLthijs48 committed Jul 24, 2016
1 parent 351d51b commit f7c8688
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ protected boolean updateRegionFlags(GeneralRegion region) {
boolean result = true;

// General region flags
ConfigurationSection generalFlags = plugin.getConfig().getConfigurationSection("flagProfiles."+region.getStringSetting("general.flagProfile")+".ALL");
if(generalFlags != null) {
String allPath = "flagProfiles."+region.getStringSetting("general.flagProfile")+".ALL";
ConfigurationSection generalFlags = plugin.getConfig().getConfigurationSection(allPath);
if(plugin.getConfig().isSet(allPath) && generalFlags != null) { // Explicitely check if it is set, so don't apply if only in the default config
result = updateRegionFlags(region, generalFlags);
}

// Specific region flags
ConfigurationSection specificFlags = plugin.getConfig().getConfigurationSection("flagProfiles."+region.getStringSetting("general.flagProfile")+"."+region.getState().getValue());
result = result && specificFlags != null && updateRegionFlags(region, specificFlags);

String specificPath = "flagProfiles."+region.getStringSetting("general.flagProfile")+"."+region.getState().getValue();
if(plugin.getConfig().isSet(specificPath)) { // Do no apply default flags if they are removed from the active config
ConfigurationSection specificFlags = plugin.getConfig().getConfigurationSection(specificPath);
result = result && specificFlags != null && updateRegionFlags(region, specificFlags);
}
return result;
}
/**
Expand Down
5 changes: 1 addition & 4 deletions AreaShop/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ flagProfiles:
ALL: # Flags to apply for all states
priority: 10
members: ''
interact: 'deny g:non_members' # Only allow region members/owners to use things in the region (chests, crafting bench, etc)
build: 'deny g:non_members' # Only allow region members/owners to build (change to 'deny' to disallow building)
block-break: 'deny g:non_members'
block-place: 'deny g:non_members'
interact: 'deny g:non_members' # Only allow region members/owners to use things in the region (chests, furnace, animals, etc.)
forrent:
greeting: '%lang:prefix%%lang:greeting-forrent%'
rented:
Expand Down

0 comments on commit f7c8688

Please sign in to comment.