Solved InventoryClickEvent#setCancelled(true) working bad

Discussion in 'Plugin Development' started by w0lves, Oct 29, 2020.

  1. Offline

    w0lves

    Plugin version: 1.16.3

    Problem: when i click an item after setting event.setCancelled(true) i can "drag it" until i click again somewhere

    Okay, basically im trying to make someone not able to click items on an inventory.

    Code:
        @EventHandler
        public void onClick(InventoryClickEvent event) {
            event.setCancelled(true);
        }
    Easy, but now when i click an item i can "drag it" until i click again somewhere

    I want just the item not be able to get clicked, it's simple.. :(

    What you can do to recreate the problem: https://gyazo.com/eb02ab3762978bb3bf76db99c314a486

    The FULL Error log: No console errors

    What you have tried: I tried updating the inventory, idk
     
  2. Offline

    runaowi

    you also need to cancel the InventoryDragEvent, its a seperate event, hope that helps
     
    KarimAKL likes this.
  3. Offline

    w0lves

    Finally i found the mistake... just i was testing it on creative lol such a fail xd
     

Share This Page