From a9bc373d19b09554788a0e5492788209206b7530 Mon Sep 17 00:00:00 2001 From: NichtStudioCode <51272202+NichtStudioCode@users.noreply.github.com> Date: Sun, 12 Mar 2023 19:13:46 +0100 Subject: [PATCH] Fixed player inventory items not being initialized with DoubleWindow --- .../java/xyz/xenondevs/invui/window/AbstractWindow.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/invui/src/main/java/xyz/xenondevs/invui/window/AbstractWindow.java b/invui/src/main/java/xyz/xenondevs/invui/window/AbstractWindow.java index 9cad5b9..7bcc80e 100644 --- a/invui/src/main/java/xyz/xenondevs/invui/window/AbstractWindow.java +++ b/invui/src/main/java/xyz/xenondevs/invui/window/AbstractWindow.java @@ -171,10 +171,6 @@ public abstract class AbstractWindow implements Window, GuiParent { if (!event.getPlayer().equals(getViewer())) { event.setCancelled(true); } else { - if (currentlyOpen) - throw new IllegalStateException("Window is already opened!"); - - currentlyOpen = true; handleOpened(); if (openHandlers != null) { @@ -257,7 +253,10 @@ public abstract class AbstractWindow implements Window, GuiParent { Player viewer = getViewer(); if (viewer == null) throw new IllegalStateException("The player is not online."); + if (currentlyOpen) + throw new IllegalStateException("Window is already opened!"); + currentlyOpen = true; initItems(); WindowManager.getInstance().addWindow(this); openInventory(viewer);