mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-23 09:31:46 +00:00
Only show the shop the player targets instead of all the shops he sees
(configurable)
This commit is contained in:
parent
a4886c8cbb
commit
d161fc60ac
@ -143,9 +143,12 @@ 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 **/
|
||||
/** Whether only the shops a player has in sight should be shown to him **/
|
||||
public boolean only_show_shops_in_sight;
|
||||
|
||||
/** Whether only the shop a player is looking at should be shown to him **/
|
||||
public boolean only_show_first_shop_in_sight;
|
||||
|
||||
/**
|
||||
* <p>Whether shops should automatically be removed from the database if an error occurred while loading</p>
|
||||
* (e.g. when no chest is found at a shop's location)
|
||||
@ -373,6 +376,7 @@ public class Config {
|
||||
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");
|
||||
only_show_first_shop_in_sight = plugin.getConfig().getBoolean("only-show-first-shop-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");
|
||||
|
@ -269,23 +269,27 @@ public class ShopUtils {
|
||||
|
||||
for (Block block : sight) {
|
||||
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST) {
|
||||
if (isShop(block.getLocation())) {
|
||||
Shop shop = getShop(block.getLocation());
|
||||
Shop shop = getShop(block.getLocation());
|
||||
if (shop != null) {
|
||||
shopsInSight.add(shop);
|
||||
|
||||
if (shop.getHologram() != null && !shop.getHologram().isVisible(player)) {
|
||||
shop.getHologram().showPlayer(player);
|
||||
}
|
||||
|
||||
if (plugin.getShopChestConfig().only_show_first_shop_in_sight) break;
|
||||
}
|
||||
} else {
|
||||
Block below = block.getRelative(BlockFace.DOWN);
|
||||
if (isShop(below.getLocation())) {
|
||||
Shop shop = getShop(below.getLocation());
|
||||
Shop shop = getShop(below.getLocation());
|
||||
if (shop != null) {
|
||||
shopsInSight.add(shop);
|
||||
|
||||
if (shop.getHologram() != null && !shop.getHologram().isVisible(player)) {
|
||||
shop.getHologram().showPlayer(player);
|
||||
}
|
||||
|
||||
if (plugin.getShopChestConfig().only_show_first_shop_in_sight) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -322,6 +326,8 @@ public class ShopUtils {
|
||||
* @param player Player to show the update
|
||||
*/
|
||||
public void updateShop(Shop shop, Player player) {
|
||||
if (shop.getLocation().getChunk().isLoaded()) return;
|
||||
|
||||
double holoDistSqr = Math.pow(plugin.getShopChestConfig().maximal_distance, 2);
|
||||
double itemDistSqr = Math.pow(plugin.getShopChestConfig().maximal_item_distance, 2);
|
||||
|
||||
|
@ -65,11 +65,15 @@ enable-islandworld-integration: true
|
||||
# buy or sell something from/to his shop or if his shop is out of stock
|
||||
enable-vendor-messages: true
|
||||
|
||||
# Set whether only the shops a player points on should be shown to him.
|
||||
# Set whether only the shops a player has in sight should be shown to him.
|
||||
# If set to false, every shop near the player (with the specified
|
||||
# distance) will be shown to him.
|
||||
only-show-shops-in-sight: true
|
||||
|
||||
# Set whether only the shop a player is looking at should be shown to him.
|
||||
# This only has effect if 'only-show-shops-in-sight' is enabled
|
||||
only-show-first-shop-in-sight: true
|
||||
|
||||
# Set whether the buy- and sell price should be arranged below each other.
|
||||
# The first line will be the buy price with the message
|
||||
# "message.hologram.only-buy", the second line will be the sell price
|
||||
|
Loading…
Reference in New Issue
Block a user