From 666d97883343c41ac8cf5c1e4d51efbbdeb4d3eb Mon Sep 17 00:00:00 2001 From: sandtechnology <20417547+sandtechnology@users.noreply.github.com> Date: Sat, 29 Feb 2020 10:27:48 +0800 Subject: [PATCH] Fix invisible bug again Former-commit-id: ccb192f0fedf72fe3b3520de8027d4a03f773fa2 --- .../maxgamer/quickshop/Shop/VirtualDisplayItem.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java index f1d89d13a..cb483bb98 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java @@ -71,7 +71,7 @@ public class VirtualDisplayItem extends DisplayItem { } //Due to the delay task in ChunkListener - //We must move init task to first spawn to prevent some bug + //We must move init task to first spawn to prevent some bug and make the check lesser private void preSpawnInit() { //some time shop can be loaded when world isn't loaded if (Util.isLoaded(shop.getLocation())) { @@ -92,7 +92,7 @@ public class VirtualDisplayItem extends DisplayItem { protocolManager.removePacketListener(this); return; } - if (!isFull || !isDisplay || !shop.isLoaded() || !Util.isLoaded(shop.getLocation())) { + if (!isFull || !Util.isLoaded(shop.getLocation())) { return; } //chunk x @@ -104,13 +104,15 @@ public class VirtualDisplayItem extends DisplayItem { plugin.getServer().getScheduler().runTaskLater(plugin, () -> { World world = shop.getLocation().getWorld(); Chunk chunk = shop.getLocation().getChunk(); - if (world.getName().equals(event.getPlayer().getWorld().getName()) + if (shop.isLoaded() + &&isDisplay + &&world.getName().equals(event.getPlayer().getWorld().getName()) && chunk.getX() == x && chunk.getZ() == z) { packetSenders.add(event.getPlayer().getUniqueId()); sendFakeItem(event.getPlayer()); } - }, 1); + }, 2); } }); }