Copy from 1.4.7
Update for CraftBukkit 1.5