From feada5035096c2a0908c67ef34aa9c92b7fa74f2 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sun, 2 Jun 2019 22:09:04 +0800 Subject: [PATCH] Some improve in ContainerShop Former-commit-id: cf81b2673ea87febf0766c3def03466b7cb26b2f [formerly 653f25585cffc26a6c787ce54e06474c26f98bd2] Former-commit-id: 58bf2c8d043f7d13befc42ffc55e4207f21cfaf7 --- .../maxgamer/quickshop/Shop/ContainerShop.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java index eeee46e27..95492d873 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java @@ -673,7 +673,7 @@ public class ContainerShop implements Shop { } public void checkDisplay() { - if (plugin.isDisplay() == false) + if (!plugin.isDisplay()) return; if (getLocation().getWorld() == null) return; // not loaded @@ -690,11 +690,12 @@ public class ContainerShop implements Shop { this.getDisplayItem().spawn(); } if (this.getDisplayItem() != null) { - if (!trans) { // We have a display item in a block... delete it - this.getDisplayItem().remove(); - this.displayItem = null; - return; - } + // Already checked above + // if (!trans) { // We have a display item in a block... delete it + // this.getDisplayItem().remove(); + // this.displayItem = null; + // return; + // } DisplayItem disItem = this.getDisplayItem(); Location dispLoc = disItem.getDisplayLocation(); if (dispLoc.getBlock() != null && dispLoc.getBlock().getType() == Material.WATER) { @@ -710,7 +711,7 @@ public class ContainerShop implements Shop { if (item.getTicksLived() > 5000 || !item.isValid() || item.isDead()) { disItem.respawn(); disItem.removeDupe(); - } else if (item.getLocation().distanceSquared(dispLoc) > 1) { + } else if (checkDisplayMoved()) { item.teleport(dispLoc, TeleportCause.PLUGIN); } }