From 44e514d8c2e7c4e7a0bf10526f193160e4000999 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Sun, 15 May 2022 11:34:35 -0400 Subject: [PATCH] Don't close other inventories for opened player during close --- plugin/src/main/java/com/lishid/openinv/OpenInv.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugin/src/main/java/com/lishid/openinv/OpenInv.java b/plugin/src/main/java/com/lishid/openinv/OpenInv.java index a56292a..b7f3b01 100644 --- a/plugin/src/main/java/com/lishid/openinv/OpenInv.java +++ b/plugin/src/main/java/com/lishid/openinv/OpenInv.java @@ -522,6 +522,11 @@ public class OpenInv extends JavaPlugin implements IOpenInv { static void ejectViewers(@NotNull ISpecialInventory inventory, @NotNull Predicate<@NotNull HumanEntity> predicate) { Inventory bukkitInventory = inventory.getBukkitInventory(); for (HumanEntity viewer : new ArrayList<>(bukkitInventory.getViewers())) { + if (viewer.getUniqueId().equals(inventory.getPlayer().getUniqueId()) + && !viewer.getOpenInventory().getTopInventory().equals(bukkitInventory)) { + // Skip owner with other inventory open. They aren't actually a viewer. + continue; + } if (predicate.test(viewer)) { viewer.closeInventory(); }