Infinite chests

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

  1. Offline

    captncraig

    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

    SycoPrime

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

Share This Page