From e9bcd2dd2fc5a9766f472a4b0895d46999f67cf0 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 23 Nov 2016 17:15:15 +0100 Subject: [PATCH] Add config value to enable quality mode --- src/main/java/de/epiceric/shopchest/config/Config.java | 4 ++++ .../shopchest/listeners/HologramUpdateListener.java | 7 +++++++ src/main/resources/config.yml | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java index 4d95f18..c93bd53 100644 --- a/src/main/java/de/epiceric/shopchest/config/Config.java +++ b/src/main/java/de/epiceric/shopchest/config/Config.java @@ -68,6 +68,9 @@ public class Config { /** Whether shops should be protected by explosions **/ public boolean explosion_protection; + /** Whether quality mode should be enabled **/ + public boolean enable_quality_mode; + /** Whether hologram interaction should be enabled **/ public boolean enable_hologram_interaction; @@ -286,6 +289,7 @@ public class Config { buy_greater_or_equal_sell = plugin.getConfig().getBoolean("buy-greater-or-equal-sell"); hopper_protection = plugin.getConfig().getBoolean("hopper-protection"); two_line_prices = plugin.getConfig().getBoolean("two-line-prices"); + enable_quality_mode = plugin.getConfig().getBoolean("enable-quality-mode"); enable_hologram_interaction = plugin.getConfig().getBoolean("enable-hologram-interaction"); enable_debug_log = plugin.getConfig().getBoolean("enable-debug-log"); enable_worldguard_integration = plugin.getConfig().getBoolean("enable-worldguard-integration"); diff --git a/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java b/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java index 8289bdc..64de654 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java @@ -27,6 +27,13 @@ public class HologramUpdateListener implements Listener { @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onPlayerMove(PlayerMoveEvent e) { + if (!plugin.getShopChestConfig().enable_quality_mode && + e.getFrom().getBlockX() == e.getTo().getBlockX() && + e.getFrom().getBlockY() == e.getTo().getBlockY() && + e.getFrom().getBlockZ() == e.getTo().getBlockZ()) { + return; + } + updateHolograms(e.getPlayer()); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b654fa7..e96c820 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -14,6 +14,13 @@ language-file: "en_US" # Set whether the floating shop items on top of the chest should be shown show-shop-items: true +# Set whether quality-mode should be enabled. +# Showing and hiding holograms will look better, +# but TPS will probably decrease. +# Not recommended on servers with low performance +# or on servers with a lot of shops! +enable-quality-mode: false + # Set whether interaction with the hologram should be enabled. # If set to true, a player can do the exact same thing with the # hologram, as with the chest. You can even open the chest if you