Just a warning. This does not behave the way you expect it.

It will not check for lores and such. Just the Item amount and stack.

This will not check if the stack contains more of the required items. It means exact item stack including item count.

http://jd.bukkit.org/dev/apidocs/org/bukkit/inventory/Inventory.html#contains(org.bukkit.inventory.ItemStack)