[help] Cancelling Inventory click causing bugs

Discussion in 'Plugin Development' started by crysis992, May 23, 2013.

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

    crysis992

    Hey,

    Im currently working on a Inventory Menu, its completly working so far. But its causing a bug which i don't know how to fix.

    in my onEnable i create a custom inventory named "Permission". Adding items afterwards, and added a command to open the inventory with player.openInventory(Teleport);

    Okay, here is my listener:
    http://pastebin.com/GD3yCXVa


    Now the bug description:
    If a player clicks on a item via shift click or the new shortcut system or however its called (1-9) to assing a item to the hotbar. Since the event is cancelled, it does not move the item out of the custom inventory, but it is actually there. Which makes the player unable to build any things where the item was supposed to be, till they relog.

    Here is a video, i bought something in my shop. Then crafted a Crafting table, tried to place it, and it turned to dirt.


    Any ideas how to cancel the click event without causing such bugs?

    (Sorry for my bad english, its late ;p)
     
  2. Offline

    AstramG

    Try using player.updateInventory(); It's deprecated but thankfully still works.
     
  3. Offline

    crysis992

    If you check the code, im using it already. Bug does still occour :/
     
  4. Offline

    ZeusAllMighty11

    This can be caused by lag too
     
  5. Offline

    crysis992

    Its not caused by lag, cause it happens AFTER you use the shop/interface/menu or whatever, it doesnt happen at all if you dont use the menu.
     
  6. Offline

    lualzockt

    What about Saving the Item which was klicked and adding it after the Event to the Inventory?

    Lualzockt
     
  7. Offline

    crysis992

    I dont want to add a item at all, this plugin is just adding a permission node via vault. But cuz of the cancelled item click event, the client is adding a item to the inventory till they relog to the server and this is causing the bugs like i showed in the video.
     
Thread Status:
Not open for further replies.

Share This Page