Fix the default flagProfiles settings, fix migration issues.

This commit is contained in:
Thijs Wiefferink 2016-07-24 20:25:58 +02:00
parent 351d51b664
commit f7c86881cc
2 changed files with 9 additions and 9 deletions

View File

@ -32,15 +32,18 @@ public class WorldGuardRegionFlagsFeature extends Feature implements Listener {
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;
}
/**

View File

@ -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: