Solved Custom inven open cancel moving items in both invens?

Discussion in 'Spigot Plugin Development' started by Fahlur, Jan 15, 2020.

  1. EDIT: nevermind I managed to solve it. xD

    it was simple as checking the current inventory clicked, then including a && to check the holder of the custom inventory which was a custom inventoryHolder. which solved it for me.


    Code (Text):

    if (event.getClickedInventory().getType().equals(InventoryType.PLAYER)
                   && (event.getInventory().getHolder() instanceof CustomInventoryHolder)) {
    also ofc had to put a null check otherwise clicking outside the inventory window gives a npe as a result after this.
    #1 Fahlur, Jan 15, 2020
    Last edited: Jan 15, 2020