Fix jail-online-time with offline players#5701
Conversation
Essentials/src/main/java/com/earth2me/essentials/PlayerExtension.java
Outdated
Show resolved
Hide resolved
|
Not an upstream bug as initially thought, this is just some Essentials goofiness. |
JRoy
left a comment
There was a problem hiding this comment.
not a fan of this implementation, would rather a logoff-time entry be added to essentials userdata so we can do the calculation on our end. loading offline playerdata is unpredictable and can lead to even worse I/O issues that loading Essentials userdata.
Yeah that works too, alternative would be to get the offline player from the offline player stub which has already done the lookup at that point (so it would incur no additional cost). Or actually implementing the method on the stub itself (which we may want to update anyway - it's horribly outdated at the moment). |
Fixes #5658
Apparently you cannot get statistics for players returned by getPlayer when they are offline. This may be an upstream bug, but regardless, an easy fix here is to simply allow getting an OfflinePlayer reference from the User base for this purpose.
Below is a demonstration of the issue.
As you can see, the offline player returns the correct result, but the player base does not.