Solved How to get the inventory of a chest.

Discussion in 'Spigot Plugin Development' started by black_, Jun 1, 2017.

  1. Hi! I have location of a block and have verified it is a chest. How would I get the inventory of the chest. (whats inside it when a player clicks on it)

    Any help is appreciated. TY.
     
    • Agree Agree x 1
    • Friendly Friendly x 1
  2. Code (Text):
    Block b = //the block;

    BlockState state = b.getState();
    if (state instanceof Chest) {
      Chest chest = (Chest) state;
      Inventory inv = chest.getBlockInventory();
    }
    As @Remceau said.
     
  3. Thanks so much!
     
  4. thanks as well.