Skip to content

Commit

Permalink
Added the config setting 'register-world-guard-allow-shop-flag'
Browse files Browse the repository at this point in the history
(default: true).

This can be used to disable the registration of the 'allow-shop'
WorldGuard flag. Usually this should not be required though. Note that
changing this setting has no effect until the next server restart or
full server reload.

This replaces the just previously added system property
'shopkeepers.skip-wg-allow-shop-flag' again.
  • Loading branch information
blablubbabc committed Aug 19, 2019
1 parent 1939c02 commit 066828e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -35,7 +35,7 @@ Date format: (YYYY-MM-DD)
* Changed: Some entity attributes are setup prior to entity spawning now (such as metadata, non-persist flag and name (if it has/uses one)). This should help other plugins to identify Shopkeeper entities during spawning.
* Changed: Added setting 'increment-villager-statistics' (default: false) which controls whether opening the trading menu and trading with shopkeepers increment minecraft's 'talked-to-villager' and 'traded-with-villager' statistics. Previously the talked-to-villager statistics would always get incremented and the traded-with-villager statistic was not used.
* Added: The previous, current and next page items inside the editor view will now use their stack size to visualize the previous, current and next page number. This even works for items which are usually not stackable.
* Added: Added a system property 'shopkeepers.skip-wg-allow-shop-flag' which can be used to disable the registration of the 'allow-shop' WorldGuard flag. This should usually not be required though.
* Added: Added the config setting 'register-world-guard-allow-shop-flag' (default: true) which can be used to disable the registration of the 'allow-shop' WorldGuard flag. Note that changing this setting has no effect until the next server restart or full server reload.

API:
* API: Added interfaces for the different shopkeeper types and their offers to the API. They allow modifying the shopkeepers' trades. Factory methods for the different types of offers are provided via ShopkeepersPlugin and ShopkeepersAPI. The internal shopkeeper classes got renamed.
Expand Down
Expand Up @@ -213,11 +213,8 @@ public void onLoad() {
this.loadConfig();

// WorldGuard only allows registering flags before it gets enabled.
// By default, we always attempt to register the flag. There is no config setting for this, because this is not
// expected to be required. And a config setting would also not work for later config reloads.
// Instead, in case this is really required for some reason, a system property can be used to disable the flag
// registration.
if (System.getProperty("shopkeepers.skip-wg-allow-shop-flag", "false").equals("false")) {
// Note: Changing the config setting has no effect until the next server restart or server reload.
if (Settings.registerWorldGuardAllowShopFlag) {
WorldGuardHandler.registerAllowShopFlag();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/nisovin/shopkeepers/Settings.java
Expand Up @@ -53,6 +53,8 @@ public class Settings {

public static boolean enableWorldGuardRestrictions = false;
public static boolean requireWorldGuardAllowShopFlag = false;
public static boolean registerWorldGuardAllowShopFlag = true;

public static boolean enableTownyRestrictions = false;

/*
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/config.yml
Expand Up @@ -53,6 +53,12 @@ enable-world-guard-restrictions: false
# chests in the affected region, shop chests need to be pre-setup by someone
# else and the require-chest-recently-placed setting needs to be disabled.
require-world-guard-allow-shop-flag: false
# Whether to register the allow-shop flag with WorldGuard (if no other plugin
# has registered it yet). Usually there should be no need to disable this.
# Changing this setting has no effect until the next server restart or full
# server reload!
register-world-guard-allow-shop-flag: true

# If enabled, players will only be able to place shopkeepers in places that
# have been designated as commercial areas by Towny.
enable-towny-restrictions: false
Expand Down

0 comments on commit 066828e

Please sign in to comment.