Set Blocks (Chest, Dispenser,...) Inventory

Discussion in 'Bukkit Help' started by Zero9195, Sep 5, 2011.

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

    Zero9195

    Hi Guys,
    Probably it's just too late for me to find the method, but is there a way to set the Inventory of a chest? I found some "getInventory()" methods, but not one single "setInventory(Inventory)" method. Any other way to do it?
    Thank you in advance, a very tired
    Zero
     
  2. Offline

    zhuowei

    Couldn't you just do
    Code:java
    1. chest.getInventory().setContents(otherinv.getContents());
    2. otherinv.clear();

    which "moves" all of the contents into the chest?
    Also, you might want to ask for help in the Plugin Development section. http://forums.bukkit.org/forums/plugin-development.5/
     
  3. Offline

    Zero9195

    @zhuowei
    As you see, I was very tired last night xD
    Maybe, but if you do this, wouldn't you just change a Inventory's contents, without setting the chests Inventory to the one changed?
     
  4. Offline

    zhuowei

    Yes, but why would you need to set the inventory?
    in CraftBukkit, the getInventory method is implemented as
    Code:java
    1. public Inventory getInventory() {
    2. return new CraftInventory(chest);
    3. }

    So I don't think you can set it.
     
Thread Status:
Not open for further replies.

Share This Page