player.openInventory(Bukkit.createInventory(player,InventoryType.WORKBENCH)) opens a workbench which doesn't work. It doesn't let you take out items from the result slot. Same for anvil, enchanting, and enderchests might also not work.
To reproduce, just execute the code above.