Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

Fix Jailing offline players doesn't work with jail-online-time set to true

Open pop4959 opened this issue 1 year ago • 0 comments

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.

sender.sendMessage(String.valueOf(player.getBase().getStatistic(PLAY_ONE_TICK)));
sender.sendMessage(String.valueOf(ess.getServer().getOfflinePlayer(player.getBase().getUniqueId()).getStatistic(PLAY_ONE_TICK)));
sender.sendMessage(String.valueOf(timeDiff / 50));

90fd0a3c-20fb-42e3-badf-372405fc50b6

As you can see, the offline player returns the correct result, but the player base does not.

pop4959 avatar Feb 24 '24 03:02 pop4959