In the 'World' class the getTopSolidOrLiquidBlock function returns the top solid block only and ignores liquid blocks. For example, the player could spawn under water or lava.
Currently, the condition for a valid block is:
(blockid != 0 && blockMaterial.blocksMovement() && blockMaterial != Material.leaves)
blocksMovement() does not apply to liquids.
The 'Material' class already has functions called isLiquid() and isSolid()
Edit: It also doesn't return the coordinates of the found block, it augments the Y axis by 1 first.