@SuppressWarnings("deprecation") @EventHandler public void click(InventoryClickEvent event) { Player player = (Player) event.getView().getPlayer(); OpenQuestLog oql = getOpenQuestLog(player); if (oql == null) return; event.setCancelled(true); if (event.getView() != oql.getInventoryView()) { player.updateInventory(); return; } if (event.getCurrentItem() == null) { player.updateInventory(); return; } Quest sel = oql.getSelected(); if (sel == null) { if (event.getSlot() == 27) { oql.setViewingCompleted(!oql.isViewingCompleted()); oql.update(); } else { int index = (oql.getPage() - 1) * 27 + event.getSlot(); Quest[] q = oql.isViewingCompleted() ? oql.getCurrentCompletedList() : oql.getCurrentQuestList(); if (index < q.length) { oql.setSelected(q[index]); oql.update(); } } } else if (event.getSlot() == 27) { oql.setSelected(null); oql.update(); } player.updateInventory(); }