Odd issue with inventory click event...

Discussion in 'Plugin Development' started by mine-care, Jun 4, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    mine-care

    Im trying to cancel the event when the slot clicked is equal to 1 (2nd slot in hotbar)
    But the error is: the first time i click the item, its canceled but if i do it no mater how long after that, it lets me pick it, move it, drop it ect...! same if i check for its name instead of slot! :-( debug showed that the if the slot or if the name... code is executed and after a click its not. code:

    Code:java
    1. public void invmove(InventoryClickEvent e){
    2. if(e.getInventory()instanceof PlayerInventory){
    3. Player p =(Player) e.getWhoClicked();
    4. if(e.getCurrentItem().getItemMeta().getDisplayName().equals("┬ž1┬žlNavigator")){
    5. p.sendMessage("is slot 2");
    6. e.setCancelled(true);
    7. return;
    8. }
    9. }


    and yes event IS registered....
     
  2. Offline

    eccentric_nz

    There is a client bug in Minecraft 1.7.2 that lets players still pick and move blocks even though the event is cancelled, it is fixed in later versions...
     
  3. Offline

    AdamQpzm

    mine-care p.updateInventory() is a synonym for performMagic()
     
  4. Offline

    fireblast709

    mine-care try setting the result to DENY, or try also listening to the ItemDragEvent (though not sure if it would even be fired in your case)
     
  5. Offline

    mine-care

    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page