diff --git a/Common/src/main/java/fr/maxlego08/menu/inventory/zinv/ZInventory.java b/Common/src/main/java/fr/maxlego08/menu/inventory/zinv/ZInventory.java index bf5c01c4..ac866b23 100644 --- a/Common/src/main/java/fr/maxlego08/menu/inventory/zinv/ZInventory.java +++ b/Common/src/main/java/fr/maxlego08/menu/inventory/zinv/ZInventory.java @@ -321,7 +321,8 @@ public void closeInventory(Player player, InventoryEngine inventoryDefault) { menuPlugin.getScheduler().runAtEntityLater(player, task -> { InventoryHolder newHolder = CompatibilityUtil.getTopInventory(player).getHolder(); boolean isInNewzMenuInventory = newHolder instanceof InventoryDefault; - if (newHolder != null && !(newHolder instanceof InventoryDefault)) { + // A null holder is still another inventory (InvUI windows, Bukkit.createInventory(null, ...)), not a zMenu one + if (!isInNewzMenuInventory) { List sessionItems = this.clearInventory && this.clearInvType != ClearInvType.PACKET_EVENT ? this.collectSessionItems(player, inventoryDefault) : Collections.emptyList(); diff --git a/changelog.md b/changelog.md index edf3e854..6c93eede 100644 --- a/changelog.md +++ b/changelog.md @@ -22,6 +22,7 @@ * Added `ActionPlayerData#getScope`. `ZActionPlayerData` now takes the `MenuPlugin` and a `VariableScope`. * Removed the legacy `ClassicMeta` formatter. zMenu always formats items, messages and titles with MiniMessage through `ComponentMeta`. If it cannot start, zMenu logs an error and disables itself. `enable-mini-message-format` now only controls Dialogs support. * You must use zMenu+ to be able to use the hot reload. +* Fixed `clear-inventory` menus not giving the player's inventory back when they open an inventory without holder, such as an InvUI window or `Bukkit.createInventory(null, ...)`, from a menu: the player kept the `player-inventory` buttons as real items in place of their own items, until they reconnected or closed another menu with `clear-inventory`. ## New Features