This is annoying. Damn gravity. Some code sampled from BukkitDev forums.