The nullpointerexception happened when, in rare cases, the variable "lastPlayerLocation" is null and the player is attacked instantly on login.