Update JavaSetSlotTranslator.java

This commit is contained in:
AJ Ferguson 2019-10-20 15:24:29 -08:00
parent 8ae803b9a5
commit 06358b2449

View file

@ -55,17 +55,15 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
cursorPacket.setSlot(ItemData.AIR); cursorPacket.setSlot(ItemData.AIR);
session.getUpstream().sendPacket(cursorPacket); session.getUpstream().sendPacket(cursorPacket);
Geyser.getGeneralThreadPool().schedule(() -> { Inventory inventory = session.getInventoryCache().getOpenInventory();
Inventory inventory = session.getInventoryCache().getOpenInventory(); if (inventory != null) {
if (inventory != null) { session.setReopeningWindow(inventory.getId());
session.setReopeningWindow(inventory.getId()); } else {
} else { inventory = session.getInventory();
inventory = session.getInventory(); }
} ContainerClosePacket closePacket = new ContainerClosePacket();
ContainerClosePacket closePacket = new ContainerClosePacket(); closePacket.setWindowId((byte) inventory.getId());
closePacket.setWindowId((byte) inventory.getId()); Geyser.getGeneralThreadPool().schedule(() -> session.getUpstream().sendPacket(closePacket), 150, TimeUnit.MILLISECONDS);
session.getUpstream().sendPacket(closePacket);
}, 150, TimeUnit.MILLISECONDS);
} }
session.getInventory().setCursor(packet.getItem()); session.getInventory().setCursor(packet.getItem());