Reimplement 84dbc21aa71b96fd1d2ea40d624b536309118cde   Fixes BUKKIT-4692