Ported from CraftBukkit, will be edited later xD