Fixed player inventory items not being initialized with DoubleWindow

This commit is contained in:
NichtStudioCode 2023-03-12 19:13:46 +01:00
parent 9b336db0a8
commit a9bc373d19

@ -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);