public static boolean doMinecartCollection(final MinecartManiaMinecart minecart) {
    if (minecart.getBlockTypeAhead() != null) {
      if (minecart.getBlockTypeAhead().getType().getId() == Material.CHEST.getId()) {
        final MinecartManiaChest chest =
            MinecartManiaWorld.getMinecartManiaChest(
                (Chest) minecart.getBlockTypeAhead().getState());

        if (SignCommands.isNoCollection(chest)) return false;

        if (minecart instanceof MinecartManiaStorageCart) {
          final MinecartManiaStorageCart storageCart = (MinecartManiaStorageCart) minecart;
          boolean failed = false;
          for (final ItemStack item : storageCart.getInventory().getContents()) {
            if (!chest.addItem(item)) {
              failed = true;
              break;
            }
          }
          if (!failed) {
            storageCart.getInventory().clear();
          }
        }
        if (chest.addItem(minecart.getType().getId())) {

          minecart.kill(false);
          return true;
        }
      }
    }
    return false;
  }
 public static boolean doCollectParallel(final MinecartManiaMinecart minecart) {
   final ArrayList<Block> blockList = minecart.getParallelBlocks();
   for (final Block block : blockList) {
     if (block.getState() instanceof Chest) {
       final MinecartManiaChest chest =
           MinecartManiaWorld.getMinecartManiaChest((Chest) block.getState());
       final ArrayList<Sign> signList =
           SignUtils.getAdjacentMinecartManiaSignList(chest.getLocation(), 1);
       for (final Sign sign : signList) {
         for (int i = 0; i < sign.getNumLines(); i++) {
           if (sign.getLine(i).toLowerCase().contains("parallel")) {
             sign.setLine(i, "[Parallel]");
             if (!minecart.isMovingAway(block.getLocation())) {
               if (chest.addItem(minecart.getType().getId())) {
                 minecart.kill(false);
                 return true;
               }
             }
           }
         }
       }
     }
   }
   return false;
 }
 public static MinecartManiaInventory getMinecartManiaInventory(Block block) {
   MinecartManiaInventory inventory = null;
   if (block.getState() instanceof Chest) {
     inventory = MinecartManiaWorld.getMinecartManiaChest((Chest) block.getState());
     // check for double chest
     if (inventory != null && ((MinecartManiaChest) inventory).getNeighborChest() != null) {
       inventory =
           new MinecartManiaDoubleChest(
               (MinecartManiaChest) inventory,
               ((MinecartManiaChest) inventory).getNeighborChest());
     }
   } else if (block.getState() instanceof Dispenser) {
     inventory = MinecartManiaWorld.getMinecartManiaDispenser((Dispenser) block.getState());
   } else if (block.getState() instanceof Furnace) {
     inventory = MinecartManiaWorld.getMinecartManiaFurnace((Furnace) block.getState());
   }
   return inventory;
 }