InventoryOpenEvent problem

Discussion in 'Plugin Development' started by randomizer1234, Jul 6, 2012.

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

    randomizer1234

    Hello,
    in the plugin I'm making I'm listening to the InventoryOpenEvent event.
    Sometimes I have to .setCancelled(true) the event, but when I do this the chest doesn't visually close (not the inventory window, the chest!) and even if I disconnect and reconnect to the server the chest is always open.
    How can I close the chest after the .setCancelled(true)?

    Thank you.
     
  2. Offline

    ItsHarry

    You can't cancel an inventoryopenevent. You have to cancel the PlayerInteractEvent instead for when a player right clicks a chest.
     
  3. Offline

    Firefly

    InventoryOpenEvent implements Cancellable.
     
  4. Offline

    ItsHarry

    I know but have you ever tried cancelling it? I have and it didn't work for me
     
  5. Offline

    stelar7

    Canceling it works for me, but as OP said, the chest stays open...
     
  6. Offline

    Firefly

    How about getting the Chest state and running an update() on it?
     
  7. Offline

    stelar7

    I tried it a while back and it didn't work, might work now tho...
     
  8. Offline

    bobacadodl

    What about canceling an inventory open event when a player opens their inventory? I tried doing that and it didn't work. Does anyone know how to do this?

    wait, isn't there a closeInventory method? can't we use that?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  9. Offline

    randomizer1234

    So I should listen to PlayerInteractEvent? But in this case I think that InventoryOpenEvent becomes useless... Isn't the fact that the chest stays open a bug?
     
  10. Offline

    stelar7

    most likely
     
Thread Status:
Not open for further replies.

Share This Page