From 0b92a68e199f8f56582357bdcf4bf2034777b91b Mon Sep 17 00:00:00 2001 From: sandtechnology <20417547+sandtechnology@users.noreply.github.com> Date: Sat, 29 Feb 2020 11:46:39 +0800 Subject: [PATCH] solve the Deadlock Former-commit-id: babe2b9523ded9f6f76b12a1320897a628eaf924 --- .../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 7f23e3b511..9bd17de69a 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java @@ -98,7 +98,8 @@ public void onPacketSending(PacketEvent event) { int x = event.getPacket().getIntegers().read(0); //chunk z int z = event.getPacket().getIntegers().read(1); - + //check later to prevent deadlock + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,()->{ World world = shop.getLocation().getWorld(); Chunk chunk = shop.getLocation().getChunk(); if (world.getName().equals(event.getPlayer().getWorld().getName()) @@ -107,8 +108,8 @@ public void onPacketSending(PacketEvent event) { packetSenders.add(event.getPlayer().getUniqueId()); sendFakeItem(event.getPlayer()); } - } - }; + },1); + }}; } protocolManager.addPacketListener(packetAdapter); }