Infinite chests

Discussion in 'Archived: Plugin Requests' started by captncraig, Feb 11, 2011.

  1. Offline


    I'm not sure if this exists or not, but I would like to place a chest, and put a sign above it with the name of an item. Every time I open the chest I want it to be full of that item. I don't have the time or knowledge to implement it, but it would be pretty nice for an admin room or something.
  2. Offline


    Hook onBlockRightClick or blockinteract or whatever it's called, like all of the protection mods do.
    Then something like
    Code (Text):
    2. (if clicked block is a chest)
    4. World world = event.player.getWorld();
    5. Location loc = event.getBlock().getLocation();
    7. loc.setY(loc.getY() + 1);
    8. Block signBlock = world.getBlockAt(loc);
    10. if(signBlock.getMaterial() == Material.SIGN) {
    11. Sign sign = (sign) signBlock.getState();
    12. Material mat = Material.getMaterial(sign.getLine(0));
    13. if(mat != null) {
    14. loop through all of the inventory slots in the chest
    15. set the itemstack to type "mat", amount 64
    16. }

Share This Page