Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.bukkit.Location;
import org.bukkit.Server;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
Expand Down Expand Up @@ -133,6 +134,14 @@ private void seenOnline(final CommandSource sender, final User user, final boole
if (showIp) {
sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString()));
}
final long firstPlayed = user.getBase().getFirstPlayed();
final long lastPlayed = user.getBase().getLastPlayed();
if (firstPlayed != 0L) {
sender.sendMessage(tl("whoisFirstPlayed", formatTime(firstPlayed)));
}
if (lastPlayed != 0L) {
sender.sendMessage(tl("whoisLastPlayed", formatTime(lastPlayed)));
}
}

private void seenOffline(final CommandSource sender, final User user, final boolean showBan, final boolean showIp, final boolean showLocation) {
Expand Down Expand Up @@ -189,6 +198,14 @@ private void seenOffline(final CommandSource sender, final User user, final bool
sender.sendMessage(tl("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
}
}
final long firstPlayed = user.getBase().getFirstPlayed();
final long lastPlayed = user.getBase().getLastPlayed();
if (firstPlayed != 0L) {
sender.sendMessage(tl("whoisFirstPlayed", formatTime(firstPlayed)));
}
if (lastPlayed != 0L) {
sender.sendMessage(tl("whoisLastPlayed", formatTime(lastPlayed)));
}
}

private void seenIP(final CommandSource sender, final String ipAddress, final String display) {
Expand Down Expand Up @@ -222,6 +239,12 @@ private void seenIP(final CommandSource sender, final String ipAddress, final St

}

private String formatTime(long time) {
final Date date = new Date(time);
final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, ess.getI18n().getCurrentLocale());
return formatter.format(date);
}

@Override
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
if (args.length == 1) {
Expand Down
2 changes: 2 additions & 0 deletions Essentials/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ whoisCommandUsage=/<command> <nickname>
whoisCommandUsage1=/<command> <player>
whoisCommandUsage1Description=Gives basic information about the specified player
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFirstPlayed=\u00a76 - Joined:\u00a7r {0}
whoisFly=\u00a76 - Fly mode\:\u00a7r {0} ({1})
whoisSpeed=\u00a76 - Speed\:\u00a7r {0}
whoisGamemode=\u00a76 - Gamemode\:\u00a7r {0}
Expand All @@ -1483,6 +1484,7 @@ whoisHealth=\u00a76 - Health\:\u00a7r {0}/20
whoisHunger=\u00a76 - Hunger\:\u00a7r {0}/20 (+{1} saturation)
whoisIPAddress=\u00a76 - IP Address\:\u00a7r {0}
whoisJail=\u00a76 - Jail\:\u00a7r {0}
whoisLastPlayed=\u00a76 - Last online:\u00a7r {0}
whoisLocation=\u00a76 - Location\:\u00a7r ({0}, {1}, {2}, {3})
whoisMoney=\u00a76 - Money\:\u00a7r {0}
whoisMuted=\u00a76 - Muted\:\u00a7r {0}
Expand Down