Fix last login timestamp in Island#showInfo() being 0 due to how OfflinePlayer#getLastPlayed() works.

This commit is contained in:
Florian CUNY 2018-08-30 23:28:50 +02:00
parent d0ddf3d9bc
commit 1e791f8497

View File

@ -601,8 +601,11 @@ public class Island implements DataObject {
user.sendMessage("commands.admin.info.unowned"); user.sendMessage("commands.admin.info.unowned");
} else { } else {
user.sendMessage("commands.admin.info.owner", "[owner]", plugin.getPlayers().getName(owner), "[uuid]", owner.toString()); user.sendMessage("commands.admin.info.owner", "[owner]", plugin.getPlayers().getName(owner), "[uuid]", owner.toString());
Date d = new Date(plugin.getServer().getOfflinePlayer(owner).getLastPlayed());
user.sendMessage("commands.admin.info.last-login","[date]", d.toString()); // Fixes #getLastPlayed() returning 0 when it is the owner's first connection.
long lastPlayed = (plugin.getServer().getOfflinePlayer(owner).getLastPlayed() != 0) ?
plugin.getServer().getOfflinePlayer(owner).getLastPlayed() : plugin.getServer().getOfflinePlayer(owner).getFirstPlayed();
user.sendMessage("commands.admin.info.last-login","[date]", new Date(lastPlayed).toString());
user.sendMessage("commands.admin.info.deaths", "[number]", String.valueOf(plugin.getPlayers().getDeaths(world, owner))); user.sendMessage("commands.admin.info.deaths", "[number]", String.valueOf(plugin.getPlayers().getDeaths(world, owner)));
String resets = String.valueOf(plugin.getPlayers().getResets(world, owner)); String resets = String.valueOf(plugin.getPlayers().getResets(world, owner));