private void handleScreenCloseCancelled(SpoutPlayer player, ScreenCloseEvent e, boolean update) {
   this.action = (byte) ScreenAction.Close.getId();
   PopupScreen screen = player.getMainScreen().getActivePopup();
   if (screen != null) {
     if (update) {
       screen.onScreenClose(e);
     }
     if (!e.isCancelled() && ScreenType.getType(this.screen) == ScreenType.CUSTOM_SCREEN) {
       handleScreenClose(player, e, false);
       return;
     }
     screen.setDirty(true);
     player.sendImmediatePacket(new PacketWidget(screen, screen.getId()));
   }
 }
 private void handleScreenClose(SpoutPlayer player, ScreenCloseEvent e, boolean update) {
   PopupScreen p = player.getMainScreen().getActivePopup();
   if (update && p != null) {
     p.onScreenClose(e);
   }
   if (e.isCancelled()) {
     handleScreenCloseCancelled(player, e, false);
     return;
   }
   player.getMainScreen().closePopup();
   if (player.getItemOnCursor() != null && p != null) {
     p.handleItemOnCursor(player.getItemOnCursor());
     player.setItemOnCursor(null);
   }
 }