ScreenCloseEvent event = new ScreenCloseEvent(player, getActivePopup(), ScreenType.CUSTOM_SCREEN);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
}
player.sendImmediatePacket(new PacketScreenAction(ScreenAction.Close, ScreenType.CUSTOM_SCREEN));
activePopup = null;
player.openScreen(ScreenType.GAME_SCREEN, false);
return true;
}