diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java index 6827650c5ef..0c1065bef18 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandseen.java @@ -113,6 +113,10 @@ private void seenOnline(final CommandSource sender, final User user, final boole sender.sendTl("whoisUuid", user.getBase().getUniqueId().toString()); } + if (sender.isAuthorized("essentials.seen.firstlogin")) { + sender.sendTl("whoisFirstLogin", DateUtil.formatDate(user.getBase().getFirstPlayed(), ess)); + } + if (user.isAfk()) { sender.sendTl("whoisAFK", CommonPlaceholders.trueFalse(sender, true)); } diff --git a/Essentials/src/main/java/com/earth2me/essentials/utils/DateUtil.java b/Essentials/src/main/java/com/earth2me/essentials/utils/DateUtil.java index 4cda87d3ca6..fcfb540a2f6 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/utils/DateUtil.java +++ b/Essentials/src/main/java/com/earth2me/essentials/utils/DateUtil.java @@ -1,7 +1,9 @@ package com.earth2me.essentials.utils; +import net.ess3.api.IEssentials; import net.ess3.api.TranslatableException; +import java.text.DateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.regex.Matcher; @@ -170,4 +172,11 @@ public static String formatDateDiff(final Calendar fromDate, final Calendar toDa } return sb.toString().trim(); } + + public static String formatDate(final long date, final IEssentials ess) { + final GregorianCalendar gc = new GregorianCalendar(); + gc.setTimeInMillis(date); + final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, ess.getI18n().getCurrentLocale()); + return df.format(gc.getTime()); + } } diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 7385893f059..740d3648cd5 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -1594,6 +1594,7 @@ whoisPlaytime= - Playtime\: {0} whoisTempBanned= - Ban expires\: {0} whoisTop= \=\=\=\=\=\= WhoIs\: {0} \=\=\=\=\=\= whoisUuid= - UUID\: {0} +whoisFirstLogin= - First login: {0} whoisWhitelist= - Whitelist\: {0} workbenchCommandDescription=Opens up a workbench. workbenchCommandUsage=/ diff --git a/Essentials/src/main/resources/plugin.yml b/Essentials/src/main/resources/plugin.yml index 5ae740a886d..51e42390c6a 100644 --- a/Essentials/src/main/resources/plugin.yml +++ b/Essentials/src/main/resources/plugin.yml @@ -1158,6 +1158,8 @@ permissions: description: Allows access to the /seen command with location essentials.seen.uuid: description: Allows access to the /seen command with UUID + essentials.seen.firstlogin: + description: Allows access to the /seen command with first login time essentials.seen.whitelist: description: Allows access to the /seen command with whitelist status essentials.seen.ipsearch: @@ -1170,6 +1172,7 @@ permissions: essentials.seen.ip: true essentials.seen.location: true essentials.seen.uuid: true + essentials.seen.firstlogin: true essentials.seen.whitelist: true essentials.sell: description: Allows access to the /sell command