How To Make A dispenser Refill Itself?

Discussion in 'Plugin Development' started by hurleyboarder, Feb 17, 2014.

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

    hurleyboarder

    Hi, I was wondering what an example of code would be like to refill a dispenser or chest forever.
     
  2. Offline

    PePsiGam3r

    Did you mean, if the chest opened it will refill?
     
  3. Offline

    Pugmatt

    I would try running a Runnable and keep refilling it. You would obviously also have to have some ItemStack variables for what you would like to refill. To cause less lag, I would try and make it so it only fills it when it actually needs it. So if the contents are exactly the same as before and doesn't need a refill, don't refill it.

    Correct me if this could be done better.
     
  4. Offline

    DonkeyTeeth2013

    I would use the BlockDispenseEvent and check to see if the block is a key in a hashmap, and if it is, set the contents of the corresponding itemstack array that the hashmap has as a value.
     
Thread Status:
Not open for further replies.

Share This Page