How to update the inventory

Discussion in 'Plugin Development' started by blackshade, Jan 12, 2011.

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

    blackshade

    Hi,

    I have made a little plugin, but it needs to remove 2 items out of the inventory. Well al works fine, except that you don't see that the items are removed instandly, you need to log out and login before you see that the inventory is changed.

    this is that particular part of the code:
    Code:
                                    int itemIndex = inv.first(265);
                                    ItemStack item = inv.getItem(itemIndex);
                                    item.setAmount(item.getAmount()-1);
    I think I miss something like an .update(); but I can't find that sort of function in github or javadocs


    thanks,
    Blacksgade
     
  2. Offline

    ursa_arcadius

    It seems to be working for me just fine. Let us know if it still isn't working.
     
  3. Offline

    darknesschaos

    be careful, if it goes down to 0, nothing will happen. in that situation you will need to make the stack go null.
     
Thread Status:
Not open for further replies.

Share This Page