@Test public void inventoryClicked() { PlayerPages playerPages = mock(PlayerPages.class); when(playerPages.hasSession(any())).thenReturn(true); pageSwitcher = mock(PageSwitcher.class); SlotActions slotActions = mock(SlotActions.class); UUID uuid = UUID.randomUUID(); InventoryClickEvent event = mock(InventoryClickEvent.class); when(event.getWhoClicked()).thenAnswer(invocationOnMock -> { HumanEntity humanEntity = mock(HumanEntity.class); when(humanEntity.getUniqueId()).thenReturn(uuid); return humanEntity; }); this.multiPageListener = new MultiPageListener(pageSwitcher, slotActions, playerPages); this.clickNextPage(event, uuid); this.clickPreviousPage(event, uuid); this.arbitraryClick(event, slotActions, uuid); }
@EventHandler public void inventoryClicked(InventoryClickEvent e) { if (playerPages.hasSession(e.getWhoClicked().getUniqueId())) { e.setCancelled(true); ItemStack currentItem = e.getCurrentItem(); if (currentItem != null) { handleItemClick(e, currentItem); } } }
MultiPageListener implements Listener { @EventHandler public void inventoryClicked(InventoryClickEvent e) { if (playerPages.hasSession(e.getWhoClicked().getUniqueId())) { e.setCancelled(true); ItemStack currentItem = e.getCurrentItem(); if (currentItem != null) { handleItemClick(e, currentItem); } } } }
MultiPageListener implements Listener { @EventHandler public void inventoryClicked(InventoryClickEvent e) { if (playerPages.hasSession(e.getWhoClicked().getUniqueId())) { e.setCancelled(true); ItemStack currentItem = e.getCurrentItem(); if (currentItem != null) { handleItemClick(e, currentItem); } } }  }
MultiPageListener implements Listener { @EventHandler public void inventoryClicked(InventoryClickEvent e) { if (playerPages.hasSession(e.getWhoClicked().getUniqueId())) { e.setCancelled(true); ItemStack currentItem = e.getCurrentItem(); if (currentItem != null) { handleItemClick(e, currentItem); } } }  @EventHandler void inventoryClicked(InventoryClickEvent e); @EventHandler void inventoryClosed(InventoryCloseEvent e); @EventHandler void quit(PlayerQuitEvent event); }
MultiPageListener implements Listener { @EventHandler public void inventoryClicked(InventoryClickEvent e) { if (playerPages.hasSession(e.getWhoClicked().getUniqueId())) { e.setCancelled(true); ItemStack currentItem = e.getCurrentItem(); if (currentItem != null) { handleItemClick(e, currentItem); } } }  @EventHandler void inventoryClicked(InventoryClickEvent e); @EventHandler void inventoryClosed(InventoryCloseEvent e); @EventHandler void quit(PlayerQuitEvent event);  }