mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix confirming when the server double-sends a window ID
This commit is contained in:
parent
ab9501da69
commit
f02105e9c7
2 changed files with 6 additions and 2 deletions
|
@ -36,6 +36,9 @@ public class JavaCloseWindowTranslator extends PacketTranslator<ServerCloseWindo
|
|||
|
||||
@Override
|
||||
public void translate(ServerCloseWindowPacket packet, GeyserSession session) {
|
||||
session.addInventoryTask(() -> InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId())));
|
||||
session.addInventoryTask(() ->
|
||||
// Sometimes the server can request a window close of ID 0... when the window isn't even open
|
||||
// Don't confirm in this instance
|
||||
InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ public class JavaOpenWindowTranslator extends PacketTranslator<ServerOpenWindowP
|
|||
|
||||
Inventory newInventory = newTranslator.createInventory(name, packet.getWindowId(), packet.getType(), session.getPlayerInventory());
|
||||
if (openInventory != null) {
|
||||
InventoryUtils.closeInventory(session, openInventory.getId(), true);
|
||||
// Sometimes the server can double-open an inventory with the same ID - don't confirm in that instance.
|
||||
InventoryUtils.closeInventory(session, openInventory.getId(), openInventory.getId() != packet.getWindowId());
|
||||
}
|
||||
|
||||
session.setInventoryTranslator(newTranslator);
|
||||
|
|
Loading…
Reference in a new issue