Guest User

Untitled

a guest
Apr 19th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1.         // Check for double-chest
  2.         LinkedList<Block> directions = new LinkedList<Block>();
  3.         directions.add(block.getRelative(BlockFace.NORTH));
  4.         directions.add(block.getRelative(BlockFace.SOUTH));
  5.         directions.add(block.getRelative(BlockFace.EAST));
  6.         directions.add(block.getRelative(BlockFace.WEST));
  7.             for (Block b : directions) {
  8.                 state = b.getState();
  9.         if (state.getType() == org.bukkit.Material.CHEST) {
  10.             contents = ((Chest) state).getInventory();
  11.             for (ItemStack items : contents.getContents()) {
  12.             if (items != null && items.getType() == Material.SAND) {
  13.                 sand += items.getAmount();
  14.                 }
  15.             }
  16.             }
  17.             break;
  18.         }
  19.         }
Add Comment
Please, Sign In to add comment