Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
Fix confirming when the server double-sends a window ID
Dieser Commit ist enthalten in:
Ursprung
ab9501da69
Commit
f02105e9c7
@ -36,6 +36,9 @@ public class JavaCloseWindowTranslator extends PacketTranslator<ServerCloseWindo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerCloseWindowPacket packet, GeyserSession session) {
|
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());
|
Inventory newInventory = newTranslator.createInventory(name, packet.getWindowId(), packet.getType(), session.getPlayerInventory());
|
||||||
if (openInventory != null) {
|
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);
|
session.setInventoryTranslator(newTranslator);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren