Refilling Chests

Discussion in 'Plugin Development' started by MrGamingLion66, Sep 27, 2016.

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

    MrGamingLion66

    Hello everyone, has a plugin I am making for my friends server I need to know how to refill the contents of chest. For example, In Sky Wars at a certain point the chest contents need to be refilled. Can anyone help me with this?
     
  2. Offline

    Zombie_Striker

    @MrGamingLion66
    1. Keep a List of all the locations where you want to refill chests.
    2. When you want to refill those chests, use a for-each loop to loop through all the locations.
    3. Check if the block at that location is a chest. If so, get the block's state and cast the blockstate to a "Chest"
    4. Using that "Chest" instance, get the inventory and add the items you want.
     
  3. Offline

    MrGamingLion66

Thread Status:
Not open for further replies.

Share This Page