Solved Opening chest event

Discussion in 'Plugin Development' started by cdnyassuo34, Jul 28, 2019.

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

    cdnyassuo34

    Hi, I know I am asking many question but I am learning ^^
    I would like to know if this is possible to detect when a player open a chest and get the chest location .
    If you have any good solutions I would be happy to know which event or how I can do this ^^ (I have a bad englis hbut I know ^^ I am french so yea ^^)
     
  2. Offline

    Kars

  3. Offline

    Machine Maker

    Just to point out, the PlayerInteractEvent will fire any time ANY block is clicked so make sure to filter out any non-chest blocks. :D
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    Machine Maker

    Yep, that works too. InventoryOpenEvent is fired way less. Make sure you check that Inventory#getLocation() isn't null because I'm not sure what happens if its a "virtual" inventory.

    EDIT: You will probably need to filter out the other types of inventories as well.
     
  6. Offline

    Kars

    @timtower Well he said he wanted to get the chest location, so.
     
  7. Offline

    timtower Administrator Administrator Moderator

  8. Offline

    cdnyassuo34

    thanks for the help ^^
     
Thread Status:
Not open for further replies.

Share This Page