Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
solve the Deadlock
Browse files Browse the repository at this point in the history
Former-commit-id: babe2b9
  • Loading branch information
sandtechnology committed Feb 29, 2020
1 parent 70786ae commit 0b92a68
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -107,8 +108,8 @@ public void onPacketSending(PacketEvent event) {
packetSenders.add(event.getPlayer().getUniqueId());
sendFakeItem(event.getPlayer());
}
}
};
},1);
}};
}
protocolManager.addPacketListener(packetAdapter);
}
Expand Down

0 comments on commit 0b92a68

Please sign in to comment.