Is the only way to get a chest inventory the World,Target Storage Database?

  • I mean come on. It seems you can get everything from Global ID to what is passing in and out of a storage item. What you cant seem to get is the inventory of the storage item itself. Is the only way do do this is access the database and read the BLOB? :crazy:

  • Using a PlayerInventoryToStorageEvent event

    I can get the chest ID which is the same as in the Database

    event.getStorageID()


    However, this is where I am stuck on how to get the storage object with the inventory since this event Class does not appear to me to have method.

    I assume you are saying I get the chest using getStorage() then using Item[] getItems()? Because for me, the ToStorageEvent wont bring up .getstorage() as a method of the class.


    So what you are suggesting I have to listen to

    PlayerStorageAccessEvent

    to get that. [which does work thanks]


    I was trying to watch what was being moved. If I read this correct I will have to open and close the chest to trigger the second event, true? Maybe I can catch them both at the same time for what I need to do.

    Edited once, last by angriff: added confirmation that PlayerStorageAccessEvent provides the array of items. ().

  • Ok so I do have to open and close the chest twice but I am good for now. When I open it the first time I get an Access event. When I put stuff in it, I get a ToStorage Event. To see if what was put in is the right stuff I have to close then open it since I dont appear to get an event for closing. But hey I can work with this Thanks

  • Yep just checking for correct items being placed in and counting the stacks. So I punted and said I would just count them once they were in the chest and that is where I changed to wanting to get the inventory and count it.


    PS edit. If you have/ask the player to move multiple stacks you get a new event each time and have to temporarily store the moved stacks and total. It was this lost/multiple of instance that was causing most of my anguish in how I reported it back to the player and my plugin. But it is working fine with your lead. Thanks

  • However, this is where I am stuck on how to get the storage object with the inventory since this event Class does not appear to me to have method.

    I assume you are saying I get the chest using getStorage() then using Item[] getItems()? Because for me, the ToStorageEvent wont bring up .getstorage() as a method of the class.

    Unfortunately the storage API wasn't fully ready yet, but will be part of the next update ;) This will enable you to get access to all storages (or to create new storages, for example).

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!