From e08b09fe3fd5e99593e827d82e074fd186ff07a3 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 4 Jan 2017 14:50:11 +0100 Subject: [PATCH] Allow better customization of hologram lift Closes #38 --- .../java/de/epiceric/shopchest/config/Config.java | 10 +++++++++- src/main/java/de/epiceric/shopchest/shop/Shop.java | 11 +++++++++-- src/main/resources/config.yml | 11 ++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java index af64538..960751c 100644 --- a/src/main/java/de/epiceric/shopchest/config/Config.java +++ b/src/main/java/de/epiceric/shopchest/config/Config.java @@ -126,9 +126,15 @@ public class Config { **/ public boolean invert_mouse_buttons; - /** Amount the hologram should be lifted **/ + /** Amount a hologram with two price-lines should be lifted **/ public double two_line_hologram_lift; + /** Amount a hologram with one price-line should be lifted **/ + public double one_line_hologram_lift; + + /** Amount every hologram should be lifted **/ + public double hologram_lift; + /** The maximum distance between a player and a shop to see the hologram **/ public double maximal_distance; @@ -324,6 +330,8 @@ public class Config { remove_shop_on_error = plugin.getConfig().getBoolean("remove-shop-on-error"); invert_mouse_buttons = plugin.getConfig().getBoolean("invert-mouse-buttons"); two_line_hologram_lift = plugin.getConfig().getDouble("two-line-hologram-lift"); + one_line_hologram_lift = plugin.getConfig().getDouble("one-line-hologram-lift"); + hologram_lift = plugin.getConfig().getDouble("hologram-lift"); maximal_distance = plugin.getConfig().getDouble("maximal-distance"); maximal_item_distance = plugin.getConfig().getDouble("maximal-item-distance"); shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal"); diff --git a/src/main/java/de/epiceric/shopchest/shop/Shop.java b/src/main/java/de/epiceric/shopchest/shop/Shop.java index 1cf2703..f24c6bd 100644 --- a/src/main/java/de/epiceric/shopchest/shop/Shop.java +++ b/src/main/java/de/epiceric/shopchest/shop/Shop.java @@ -190,8 +190,15 @@ public class Shop { } } - if (holoText.length == 3 && holoText[2] != null) - holoLocation.add(0, plugin.getShopChestConfig().two_line_hologram_lift, 0); + holoLocation.add(0, plugin.getShopChestConfig().hologram_lift, 0); + + if (plugin.getShopChestConfig().two_line_prices) { + if (holoText.length == 3 && holoText[2] != null) { + holoLocation.add(0, plugin.getShopChestConfig().two_line_hologram_lift, 0); + } else { + holoLocation.add(0, plugin.getShopChestConfig().one_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 b61c399..2afb4fe 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -50,12 +50,21 @@ enable-vendor-messages: true # (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, +# Set the amount (may be negative) a 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 the amount (may be negative) a hologram should be lifted in the y-axis, +# when "two-line-prices" is set to true and only buying or selling is enabled at the shop. +one-line-hologram-lift: 0 + +# Set the amount (may be negative) a hologram should be lifted in the y-axis. +# If the hologram lift is already increased by the values above, the holograms will +# still be lifted by the here specified amount. This also works with 'two-line-prices' disabled. +hologram-lift: 0 + # Set whether players should be allowed to sell their items, even if the amount they have, is # lower than the amount, the shop owner has set for the given price, or if the inventory of the chest # doesn't have enough space for all the items, but only for a few, or if the player only has enough money for