Essentials
Essentials copied to clipboard
Fix Jailing offline players doesn't work with jail-online-time set to true
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));
As you can see, the offline player returns the correct result, but the player base does not.