Player location doesnt get updated after death

Im trying to track a players location periodically. Therefor im using a task with an interval.
Everything works fine, but if the player dies the location of the player doesnt seem to update anymore.
Any ideas why this does happen?
Most of the stuff is happening in this class CaptureTimer - Pastebin.com but im quite sure everything is fine because I spend 2 hours debugging the whole thing but maybe someone finds anything idk.

Thx

The player object gets recreated when they die and respawn. Do not store a Player, store its UUID and grab the player from Sponge.getServer().getOnlinePlayer(UUID) when you need it. As you’ve found out, the Player object for a given player may change in certain circumstances.

1 Like

Thx, Ive thought about something like this but werent able to find anything.
Fixed it.

1 Like

Glad you got it working.

Just to let you know for next time, you can compare the block location of two Locations by the following.

loc1.getBlockPosition().equals(loc2.getBlockPosition())

Saves you writing it out :wink:

1 Like