From 6bce68768ab9473170a4239e636718b29f9e727b Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 10 Aug 2016 13:10:09 +0200 Subject: [PATCH] Only apply additional hologram lift on two-line-shops (When "two-line-prices" is enabled and the shop has buying and selling enabled) --- src/main/java/de/epiceric/shopchest/config/Config.java | 4 ++-- src/main/java/de/epiceric/shopchest/shop/Shop.java | 6 +++--- src/main/resources/config.yml | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java index 347db6f..9b043a2 100644 --- a/src/main/java/de/epiceric/shopchest/config/Config.java +++ b/src/main/java/de/epiceric/shopchest/config/Config.java @@ -101,7 +101,7 @@ public class Config { public boolean remove_shop_on_error; /** Amount the hologram should be lifted **/ - public double hologram_lift; + public double two_line_hologram_lift; /** The maximum distance between a player and a shop to see the hologram **/ public double maximal_distance; @@ -284,7 +284,7 @@ public class Config { append_potion_level_to_item_name = plugin.getConfig().getBoolean("append-potion-level-to-item-name"); show_shop_items = plugin.getConfig().getBoolean("show-shop-items"); remove_shop_on_error = plugin.getConfig().getBoolean("remove-shop-on-error"); - hologram_lift = plugin.getConfig().getDouble("hologram-lift"); + two_line_hologram_lift = plugin.getConfig().getDouble("two-line-hologram-lift"); maximal_distance = plugin.getConfig().getDouble("maximal-distance"); shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal"); shop_creation_price_admin = plugin.getConfig().getDouble("shop-creation-price.admin"); diff --git a/src/main/java/de/epiceric/shopchest/shop/Shop.java b/src/main/java/de/epiceric/shopchest/shop/Shop.java index 61d012e..0b33fb4 100644 --- a/src/main/java/de/epiceric/shopchest/shop/Shop.java +++ b/src/main/java/de/epiceric/shopchest/shop/Shop.java @@ -183,9 +183,6 @@ public class Shop { } else holoLocation = new Location(b.getWorld(), b.getX() + 0.5, b.getY() - 0.6, b.getZ() + 0.5); - if (holoText.length == 3) - holoLocation.add(0, plugin.getShopChestConfig().hologram_lift, 0); - holoText[0] = LanguageUtils.getMessage(LocalizedMessage.Message.HOLOGRAM_FORMAT, new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(product.getAmount())), new LocalizedMessage.ReplacedRegex(Regex.ITEM_NAME, LanguageUtils.getItemName(product))); @@ -203,6 +200,9 @@ public class Shop { } } + if (holoText.length == 3 && holoText[2] != null) + holoLocation.add(0, plugin.getShopChestConfig().two_line_hologram_lift, 0); + hologram = new Hologram(plugin, holoText, holoLocation); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6d048ac..011740e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -25,11 +25,11 @@ enable-debug-log: false # (The messages can be found and modified in the specified language file) two-line-prices: false -# Set the amount (may be negative) the hologram should be lifted -# in the y-axis (a higher number lifts the hologram more up, '1' equals to one block). -# It's recommended to change the value (to around 0.2) if "two-line-prices" is set to true, to prevent -# the floating item to intersect with the hologram. -hologram-lift: 0 +# Set the amount (may be negative) the hologram should be lifted in the y-axis, +# when "two-line-prices" is set to true and buying and selling is enabled at the shop. +# The higher the number, the higher will the hologram be. +# A value of '1' equals to one block, and a value of '0.25' is equal to the height of one line. +two-line-hologram-lift: 0.25 # Set whether players should be allowed to sell/buy broken items allow-broken-items: false