Skywars fill chests?

Discussion in 'Plugin Development' started by Didi1150, May 29, 2020.

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

    Didi1150

    How do I fill chests in my Skywars plugin, if they haven't been opened yet?
     
  2. Offline

    Wick

    You can store their locations in a set, then loop through each one at the beginning of the game and fill them
     
  3. Offline

    Didi1150

    How do I fill them ?
     
  4. Offline

    Wick

    If you have a location, check if there is a chest there, if there is:
    Code:
    Chest chest = (Chest) someLocation().getBlock().getState();
    Then you can retrieve an instance of the chest inventory
    Code:
    Inventory chestInventory = chest.getBlockInventory();
    Then you can call add/set item methods on the inventory
     
  5. Offline

    Didi1150

  6. or if a player clicks on a chest to open it and it has not been opened before. generate items otherwise do nothing
     
Thread Status:
Not open for further replies.

Share This Page