3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-03 08:21:06 +02:00

Fix closing inventory confirmation behavior (#3587)

Dieser Commit ist enthalten in:
apex_ 2023-03-03 15:09:52 +01:00 committet von GitHub
Ursprung 95d10fb7fc
Commit 10c2e51da4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -89,6 +89,10 @@ public abstract class Inventory {
@Setter
private boolean pending = false;
@Getter
@Setter
private boolean displayed = false;
protected Inventory(int id, int size, ContainerType containerType) {
this("Inventory", id, size, containerType);
}

Datei anzeigen

@ -95,6 +95,7 @@ public class InventoryUtils {
if (openInv != null && openInv.getJavaId() == inventory.getJavaId()) {
translator.openInventory(session, inventory);
translator.updateInventory(session, inventory);
openInv.setDisplayed(true);
} else if (openInv != null && openInv.isPending()) {
// Presumably, this inventory is no longer relevant, and the client doesn't care about it
displayInventory(session, openInv);
@ -103,6 +104,7 @@ public class InventoryUtils {
} else {
translator.openInventory(session, inventory);
translator.updateInventory(session, inventory);
inventory.setDisplayed(true);
}
} else {
session.setOpenInventory(null);
@ -117,7 +119,7 @@ public class InventoryUtils {
if (inventory != null) {
InventoryTranslator translator = session.getInventoryTranslator();
translator.closeInventory(session, inventory);
if (confirm && !inventory.isPending() && !(translator instanceof LecternInventoryTranslator)) {
if (confirm && inventory.isDisplayed() && !inventory.isPending() && !(translator instanceof LecternInventoryTranslator)) {
session.setClosingInventory(true);
}
}