mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-03-24 15:59:18 +01:00
Fix closing inventory confirmation behavior (#3587)
This commit is contained in:
parent
95d10fb7fc
commit
10c2e51da4
2 changed files with 7 additions and 1 deletions
|
@ -89,6 +89,10 @@ public abstract class Inventory {
|
||||||
@Setter
|
@Setter
|
||||||
private boolean pending = false;
|
private boolean pending = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private boolean displayed = false;
|
||||||
|
|
||||||
protected Inventory(int id, int size, ContainerType containerType) {
|
protected Inventory(int id, int size, ContainerType containerType) {
|
||||||
this("Inventory", id, size, containerType);
|
this("Inventory", id, size, containerType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ public class InventoryUtils {
|
||||||
if (openInv != null && openInv.getJavaId() == inventory.getJavaId()) {
|
if (openInv != null && openInv.getJavaId() == inventory.getJavaId()) {
|
||||||
translator.openInventory(session, inventory);
|
translator.openInventory(session, inventory);
|
||||||
translator.updateInventory(session, inventory);
|
translator.updateInventory(session, inventory);
|
||||||
|
openInv.setDisplayed(true);
|
||||||
} else if (openInv != null && openInv.isPending()) {
|
} else if (openInv != null && openInv.isPending()) {
|
||||||
// Presumably, this inventory is no longer relevant, and the client doesn't care about it
|
// Presumably, this inventory is no longer relevant, and the client doesn't care about it
|
||||||
displayInventory(session, openInv);
|
displayInventory(session, openInv);
|
||||||
|
@ -103,6 +104,7 @@ public class InventoryUtils {
|
||||||
} else {
|
} else {
|
||||||
translator.openInventory(session, inventory);
|
translator.openInventory(session, inventory);
|
||||||
translator.updateInventory(session, inventory);
|
translator.updateInventory(session, inventory);
|
||||||
|
inventory.setDisplayed(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
session.setOpenInventory(null);
|
session.setOpenInventory(null);
|
||||||
|
@ -117,7 +119,7 @@ public class InventoryUtils {
|
||||||
if (inventory != null) {
|
if (inventory != null) {
|
||||||
InventoryTranslator translator = session.getInventoryTranslator();
|
InventoryTranslator translator = session.getInventoryTranslator();
|
||||||
translator.closeInventory(session, inventory);
|
translator.closeInventory(session, inventory);
|
||||||
if (confirm && !inventory.isPending() && !(translator instanceof LecternInventoryTranslator)) {
|
if (confirm && inventory.isDisplayed() && !inventory.isPending() && !(translator instanceof LecternInventoryTranslator)) {
|
||||||
session.setClosingInventory(true);
|
session.setClosingInventory(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue