mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-26 02:19:48 -05:00
[VirtualDisplayItem] Reduce task amount and making chunkLocation volatile
This commit is contained in:
1 parent
0974001c1d
commit
69bf45c47a
1 file changed
+8
-8
@@ -85,7 +85,7 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
private PacketAdapter unloadPacketAdapter;
|
||||
|
||||
//cache chunk x and z
|
||||
private ShopChunk chunkLocation;
|
||||
private volatile ShopChunk chunkLocation;
|
||||
|
||||
|
||||
public VirtualDisplayItem(@NotNull Shop shop) throws RuntimeException {
|
||||
@@ -343,6 +343,13 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
if (!shop.isLoaded() || !isDisplay || !isFull || shop.isLeftShop()) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
if (player instanceof TemporaryPlayer) {
|
||||
return;
|
||||
}
|
||||
if (player == null || !player.isOnline()) {
|
||||
return;
|
||||
}
|
||||
StructureModifier<Integer> integerStructureModifier = event.getPacket().getIntegers();
|
||||
//chunk x
|
||||
int x = integerStructureModifier.read(0);
|
||||
@@ -360,13 +367,6 @@ public class VirtualDisplayItem extends DisplayItem {
|
||||
}
|
||||
chunkLocation = new ShopChunk(world.getName(), chunk.getX(), chunk.getZ());
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
if (player instanceof TemporaryPlayer) {
|
||||
return;
|
||||
}
|
||||
if (player == null || !player.isOnline()) {
|
||||
return;
|
||||
}
|
||||
if (chunkLocation.isSame(player.getWorld().getName(), x, z)) {
|
||||
packetSenders.add(player.getUniqueId());
|
||||
sendFakeItem(player);
|
||||
|
||||
Reference in new issue
Block a user