diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java index cc38ef9..f12e261 100644 --- a/src/main/java/de/epiceric/shopchest/config/Config.java +++ b/src/main/java/de/epiceric/shopchest/config/Config.java @@ -119,6 +119,9 @@ public class Config { /** Whether players are allowed to sell/buy broken items **/ public boolean allow_broken_items; + /** Whether only the shops a player points on should be shown to him **/ + public boolean only_show_shops_in_sight; + /** *
Whether shops should automatically be removed from the database if an error occurred while loading
* (e.g. when no chest is found at a shop's location) @@ -337,6 +340,7 @@ public class Config { enable_towny_integration = plugin.getConfig().getBoolean("enable-towny-integration"); enable_vendor_messages = plugin.getConfig().getBoolean("enable-vendor-messages"); explosion_protection = plugin.getConfig().getBoolean("explosion-protection"); + only_show_shops_in_sight = plugin.getConfig().getBoolean("only-show-shops-in-sight"); exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops"); append_potion_level_to_item_name = plugin.getConfig().getBoolean("append-potion-level-to-item-name"); show_shop_items = plugin.getConfig().getBoolean("show-shop-items"); diff --git a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java index 1a336ed..dc9abc1 100644 --- a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java +++ b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java @@ -3,19 +3,22 @@ package de.epiceric.shopchest.utils; import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.config.Config; import de.epiceric.shopchest.shop.Shop; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; import org.bukkit.block.DoubleChest; import org.bukkit.entity.Player; import org.bukkit.inventory.InventoryHolder; import org.bukkit.permissions.PermissionAttachmentInfo; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; public class ShopUtils { @@ -227,13 +230,62 @@ public class ShopUtils { * @param location Location of the player */ public void updateShops(Player player, Location location) { - for (Shop shop : getShops()) { - updateShop(shop, player, location); + if (plugin.getShopChestConfig().only_show_shops_in_sight) { + HashSet