From c38b02f21e4ffceea96fc3ff238f60e29fed35ef Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Tue, 3 Aug 2021 11:48:09 +0800 Subject: [PATCH] Don't load chunks in init --- .../org/maxgamer/quickshop/shop/VirtualDisplayItem.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/shop/VirtualDisplayItem.java b/src/main/java/org/maxgamer/quickshop/shop/VirtualDisplayItem.java index ec78b572a..37692b319 100644 --- a/src/main/java/org/maxgamer/quickshop/shop/VirtualDisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/shop/VirtualDisplayItem.java @@ -59,12 +59,11 @@ public class VirtualDisplayItem extends DisplayItem { private static final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); private static PacketAdapter packetAdapter = null; //cache chunk x and z - private final ShopChunk chunkLocation; + private ShopChunk chunkLocation; public VirtualDisplayItem(@NotNull Shop shop) throws RuntimeException { super(shop); - Chunk chunk = shop.getLocation().getChunk(); - chunkLocation = new ShopChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ()); + if (!managerLoaded.get()) { loadManager(); } @@ -260,6 +259,8 @@ public class VirtualDisplayItem extends DisplayItem { private void load() { Util.ensureThread(false); //some time shop can be loaded when world isn't loaded + Chunk chunk = shop.getLocation().getChunk(); + chunkLocation = new ShopChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ()); chunksMapping.put(chunkLocation, this); if (Util.isLoaded(shop.getLocation())) { //Let nearby player can saw fake item