Inventory update issue.

Discussion in 'Plugin Development' started by darknesschaos, Feb 11, 2011.

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

    darknesschaos

    When I use inventory.addItem(item); on a player that player's inventory will not be seen as changed until they open a chest. (the items are in the inventory and can be dropped if on the hotbar) How could I fix this?
     
  2. Offline

    fullwall

    Ask for the team to implement inventory.update() most probably.
     
  3. Offline

    darknesschaos

    or have it done automatically when things are added and removed from the inventory.
     
  4. Offline

    fullwall

    Indeed.
     
  5. Offline

    EvilSeph

    We've been looking into this over the past few days. We've implemented an updateInventory() function, but don't feel that this is the right way to do things, so we haven't exposed it yet.
     
  6. Offline

    darknesschaos

    Thanks for the input! The inventory updates when the player opens the chest (and other things that have an inventory I assume) maybe the answer lies there?
     
  7. Offline

    Ramblurr

    Any updates to this? I'm experiencing a similar issue. There are other ways to force an update: relog, drag/drop items into different slots.
     
  8. Offline

    Nohup

    @EvilSeph, one thing to consider will be collision. When I was writing my Philosopher's Box plugin I found that if I called the sign.update and chest.update from the same method then the first one I called was not being processed. I had to break part of my processing into an asynch thread (which is probably better anyway). Just something to consider with updates if you want to have it do it automagickally...
     
  9. Offline

    Valrix

    Something odd I noticed with inventory is that if you alter tools in the inventory it updates, but if it's a block or stack of blocks then it won't update on it's own so you'd have to call updateInventory(). Not sure why this is, but it may help solve why it doesn't update on it's own when altered.
     
  10. Offline

    Olof Larsson

    @EvilSeph
    I saw that Player.updateInventory() is deprecated.
    Does that mean you have found a solution yet?
     
  11. Offline

    EvilSeph

    No, you'll still have to use updateInventory. It's been deprecated since we added it to make it clear that it's not the proper way to do things. We should figure out why the inventory isn't being updated and fix it at the source, instead of providing a band-aid.
     
Thread Status:
Not open for further replies.

Share This Page