Refill chests

Discussion in 'Plugin Development' started by Rprrr, Nov 18, 2012.

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

    Rprrr

    Hi,

    For a plugin I'm making, I would like to know what the best way would be to refill all chests in the arena (or world).

    Is there perhaps a good plugin with an API that I can use, or do I have to write it myself? And if I have to, what would be the best approach? How would I find all chests in the area / world and what's a good way to refill them randomly?

    Thanks in advance.

    Rprrr
     
  2. Offline

    llamasaylol

    The best way is to listen to the block break and place event, check if it's a chest and add the location to a file or remove it respectively. Then when you run the refill just load the chuck of the location, fill the chest and unload the chunk if it was not loaded when you ran it.
    EDIT: Remembered why it seemed so easy for me to think how to code it yesterday. I've done it before :p
     
    leiger likes this.
  3. Offline

    kingBS11

    I don't think that's the easiest approach or best way to do it...
     
  4. Offline

    fireblast709

    you can get all TileEntities in a world, and filter out the chests
     
    chasechocolate and Milkywayz like this.
Thread Status:
Not open for further replies.

Share This Page