From f7c86881ccb949430fafe3a8c33cd7604853d3e1 Mon Sep 17 00:00:00 2001 From: Thijs Wiefferink Date: Sun, 24 Jul 2016 20:25:58 +0200 Subject: [PATCH] Fix the default flagProfiles settings, fix migration issues. --- .../features/WorldGuardRegionFlagsFeature.java | 13 ++++++++----- AreaShop/src/main/resources/config.yml | 5 +---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AreaShop/src/main/java/me/wiefferink/areashop/features/WorldGuardRegionFlagsFeature.java b/AreaShop/src/main/java/me/wiefferink/areashop/features/WorldGuardRegionFlagsFeature.java index 5ffba53b..5e463287 100644 --- a/AreaShop/src/main/java/me/wiefferink/areashop/features/WorldGuardRegionFlagsFeature.java +++ b/AreaShop/src/main/java/me/wiefferink/areashop/features/WorldGuardRegionFlagsFeature.java @@ -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; } /** diff --git a/AreaShop/src/main/resources/config.yml b/AreaShop/src/main/resources/config.yml index ce41120a..d38e3899 100644 --- a/AreaShop/src/main/resources/config.yml +++ b/AreaShop/src/main/resources/config.yml @@ -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: