Discussion in 'Plugin Development' started by hurleyboarder, Feb 17, 2014.
Hi, I was wondering what an example of code would be like to refill a dispenser or chest forever.
Did you mean, if the chest opened it will refill?
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.
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.
Separate names with a comma.