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.
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.
Thx, Ive thought about something like this but werent able to find anything.
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.
Saves you writing it out