File tree Expand file tree Collapse file tree
invui/src/main/java/xyz/xenondevs/invui/window Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -530,10 +530,8 @@ private boolean fireBukkitDragEvent(PlayerUpdateReason.Drag reason) {
530530 @ Override
531531 public void open () {
532532 Player viewer = getViewer ();
533- if (isOpen )
533+ if (isOpen || viewer . isSleeping () || ! viewer . isValid () || ! viewer . isConnected () )
534534 return ;
535- if (!viewer .isValid ())
536- throw new IllegalStateException ("Viewer is not valid" );
537535 if (isInOpeningContext .get ())
538536 throw new IllegalStateException ("Opening a window is not allowed to trigger opening another window." );
539537 if (isInCloseHandlerContext .get () > 0 )
Original file line number Diff line number Diff line change @@ -78,7 +78,12 @@ static Builder.Normal.Merged mergedBuilder() {
7878
7979 /**
8080 * Shows the window to the viewer.
81- * Does nothing if the window is already open.
81+ * Does nothing if the window is already open or if the window cannot be opened because
82+ * the viewer is {@link Player#isValid() invalid}, {@link Player#isConnected() disconnected},
83+ * {@link Player#isSleeping() sleeping}, or similar.
84+ *
85+ * @throws IllegalStateException If this function was called while opening another window
86+ * @throws IllegalStateException If this function was called while closing another window
8287 */
8388 void open ();
8489
You can’t perform that action at this time.
0 commit comments