Display time since AFK in /whois. Resolves #761.

This commit adds a getAfkSince() method to IUser.

This commit adds a whoisAFKSince message which is sent when a player is AFK, it follows the same format as whoisAFK which is still used. whoisAFK remains unchanged but is sent only when the player is not AFK.
This commit is contained in:
Ali Moghnieh 2016-07-26 01:36:29 +01:00
parent 017082c07a
commit a76b20f1b5
No known key found for this signature in database
GPG Key ID: F09D3A1BAF2E6D70
27 changed files with 39 additions and 1 deletions

View File

@ -161,4 +161,6 @@ public interface IUser {
String getAfkMessage();
void setAfkMessage(final String message);
long getAfkSince();
}

View File

@ -55,6 +55,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
private transient long teleportInvulnerabilityTimestamp = 0;
private boolean ignoreMsg = false;
private String afkMessage;
private long afkSince;
public User(final Player base, final IEssentials ess) {
super(base, ess);
@ -427,9 +428,11 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
if (set && !isAfk()) {
afkPosition = this.getLocation();
this.afkSince = System.currentTimeMillis();
} else if (!set && isAfk()) {
afkPosition = null;
this.afkMessage = null;
this.afkSince = 0;
}
if (ess.getSettings().isAfkListName()) {
if(set) {
@ -790,6 +793,11 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
}
}
@Override
public long getAfkSince() {
return afkSince;
}
/**
* Returns the {@link ItemStack} in the main hand or off-hand. If the main hand is empty then the offhand item is returned - also nullable.
*/

View File

@ -44,7 +44,11 @@ public class Commandwhois extends EssentialsCommand {
sender.sendMessage(tl("whoisGod", (user.isGodModeEnabled() ? tl("true") : tl("false"))));
sender.sendMessage(tl("whoisOp", (user.getBase().isOp() ? tl("true") : tl("false"))));
sender.sendMessage(tl("whoisFly", user.getBase().getAllowFlight() ? tl("true") : tl("false"), user.getBase().isFlying() ? tl("flying") : tl("notFlying")));
sender.sendMessage(tl("whoisAFK", (user.isAfk() ? tl("true") : tl("false"))));
if (user.isAfk()) {
sender.sendMessage(tl("whoisAFKSince", tl("true"), DateUtil.formatDateDiff(user.getAfkSince())));
} else {
sender.sendMessage(tl("whoisAFK", tl("false")));
}
sender.sendMessage(tl("whoisJail", (user.isJailed() ? user.getJailTimeout() > 0 ? DateUtil.formatDateDiff(user.getJailTimeout()) : tl("true") : tl("false"))));
sender.sendMessage(tl("whoisMuted", (user.isMuted() ? user.getMuteTimeout() > 0 ? DateUtil.formatDateDiff(user.getMuteTimeout()) : tl("true") : tl("false"))));

View File

@ -497,6 +497,7 @@ weatherStormFor=\u00a76You set the weather to \u00a7cstorm\u00a76 in\u00a7c {0}
weatherSun=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0}\u00a76.
weatherSunFor=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0} \u00a76for {1} seconds.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Banned\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Fly mode\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a77Nastavil jsi bourku v {0} na {1} sekund.
weatherSun=\u00a77Nastavil jsi slunecne pocasi v {0}
weatherSunFor=\u00a77Nastavil jsi slunecne pocasi v {0} na {1} sekund
whoisAFK=\u00a76 - AFK\:\u00a7f {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Zabanovan\:\u00a7f {0}
whoisExp=\u00a76 - Exp\:\u00a7f {0} (Uroven {1})
whoisFly=\u00a76 - Letani\:\u00a7f {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76Du \u00e6ndrede vejret til \u00a7cstorm\u00a76 i\u00a7c {
weatherSun=\u00a76Du \u00e6ndrede vejret til \u00a7csolrigt\u00a76 i\u00a7c {0}\u00a76.
weatherSunFor=\u00a76Du \u00e6ndrede vejret til \u00a7csolrigt\u00a76 i\u00a7c {0} \u00a76i {1} sekunder.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Banlyst\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Flyvetilstand\:\u00a7r {0} ({1})

View File

@ -496,6 +496,7 @@ weatherStormFor=\u00a76In \u00a7c{0} \u00a76st\u00fcrmt es nun f\u00fcr {1} Seku
weatherSun=\u00a76In \u00a7c{0}\u00a76 scheint nun die \u00a7cSonne\u00a76.
weatherSunFor=\u00a76In \u00a7c{0} \u00a76scheint nun f\u00fcr {1} Sekunden die \u00a7cSonne\u00a76.
whoisAFK=\u00a76 - Abwesend\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Gebannt\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Flugmodus\:\u00a7r {0} ({1})

View File

@ -493,6 +493,7 @@ weatherStormFor=\u00a76You set the weather to \u00a7cstorm\u00a76 in\u00a7c {0}
weatherSun=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0}\u00a76.
weatherSunFor=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0} \u00a76for {1} seconds.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Banned\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Fly mode\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a77Has establecido el tiempo como tormenta en este {1} duran
weatherSun=\u00a77Has establecido el tiempo como sol en este mundo.
weatherSunFor=\u00a77Has establecido el tiempo como sol en este {1} durante {0} segundos.
whoisAFK=\u00a77 - Ausente\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a77 - Baneado\:\u00a7f {0}
whoisExp=\u00a77 - Exp\:\u00a7f {0} (Nivel {1})
whoisFly=\u00a77 - Modo volar\:\u00a7f {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76M\u00e4\u00e4rasite ilma \u00a7ctormiseks\u00a76 maailmas
weatherSun=\u00a76M\u00e4\u00e4rasite ilma \u00a7cp\u00e4ikeselisek\u00a76 maailmas\u00a7c {0}\u00a76.
weatherSunFor=\u00a76M\u00e4\u00e4rasite ilma \u00a7cp\u00e4ikeliseks\u00a76 maailmas\u00a7c {0}\u00a76 {1} sekundiks.
whoisAFK=\u00a76 - Eemal\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Blokeeritud\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Lennure\u017eiim\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a77Laitoit myrskyn maailmaan {0} {1} sekunniksi
weatherSun=\u00a77Laitoit auringon paistamaan maailmaan {0}
weatherSunFor=\u00a77Laitoit auringon paistamaan maailmaan {0} {1} sekunniksi
whoisAFK=\u00a76 - AFK\:\u00a7f {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Banned\:\u00a7f {0}
whoisExp=\u00a76 - Exp\:\u00a7f {0} (Level {1})
whoisFly=\u00a76 - Fly mode\:\u00a7f {0} ({1})

View File

@ -493,6 +493,7 @@ weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secon
weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0}.
weatherSunFor=\u00a77Vous avez programm\u00e9 le beau temps dans {0} pour {1} seconde(s).
whoisAFK=\u00a76 - AFK/Absent \:\u00a7f {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Banni \:\u00a7f {0}
whoisExp=\u00a76 - Exp\u00e9rience \:\u00a7f {0} (Niveau {1})
whoisFly=\u00a76 - Fly mode \:\u00a7f {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76You set the weather to \u00a7cstorm\u00a76 in\u00a7c {0}
weatherSun=\u00a76Be\u00e1ll\u00edtottad az id\u00f5t \u00a7cnaposra\u00a76 a(z)\u00a7c {0}\u00a76 vil\u00e1gban.
weatherSunFor=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0} \u00a76for {1} seconds.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Bannolva\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Rep\u00fcl\u00e9s\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a77Hai cambiato il tempo in tempesta in {0} per {1} secondi
weatherSun=\u00a77Hai cambiato il tempo in soleggiato in {0}
weatherSunFor=\u00a77Hai cambiato il tempo in soleggiato in {0} per {1} secondi
whoisAFK=\u00a76 - AFK\:\u00a7f {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Esiliati\:\u00a7f {0}
whoisExp=\u00a76 - Exp\:\u00a7f {0} (Livello {1})
whoisFly=\u00a76 - Fly mode\:\u00a7f {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76{0}\u00a76\uc758 \ub0a0\uc528\uac00 {1}\u00a76\ucd08\uac0
weatherSun=\u00a76{0}\u00a76\uc758 \ub0a0\uc528\uac00 \ub9d1\uc74c\uc73c\ub85c \uc124\uc815\ub418\uc5c8\uc2b5\ub2c8\ub2e4.
weatherSunFor=\u00a77{0}\ucd08\uac04 \ub2f9\uc2e0\uc774 \uc788\ub294 \uc6d4\ub4dc\ub294 \ub9d1\uac8c \uc720\uc9c0\ub429\ub2c8\ub2e4.
whoisAFK=\u00a76 - \uc7a0\uc218\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - \ucc28\ub2e8\:\u00a7r {0}
whoisExp=\u00a76 - \uacbd\ud5d8\uce58\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - \ube44\ud589 \ubaa8\ub4dc\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76You set the weather to \u00a7cstorm\u00a76 in\u00a7c {0}
weatherSun=\u00a76Tu nustatei or\u0105 \u012f \u00a7csun\u00a76, pasaulyje\:\u00a7c {0}\u00a76.
weatherSunFor=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0} \u00a76for {1} seconds.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - U\u017eblokuotas\:\u00a7r {0}
whoisExp=\u00a76 - Exp\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Fly r\u0117\u017eimas\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76U heeft het weer in \u00a7c{0}\u00a76 naar \u00a7cstormac
weatherSun=\u00a76U heeft het weer naar \u00a7czonnig\u00a76 gezet in\u00a7c {0}\u00a76.
weatherSunFor=\u00a76U heeft het weer in \u00a7c{0}\u00a76 naar \u00a7czonnig\u00a76 gezet voor {1} seconde(n).
whoisAFK=\u00a76 - Afwezig\:\u00a7f {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Verbannen\:\u00a7f {0}
whoisExp=\u00a76 - Exp\:\u00a7f {0} (Level {1})
whoisFly=\u00a76 - Vlieg modus\:\u00a7f {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a77Ustawiles \u00a7cburze\u00a77 w\u00a7c {0} \u00a77na {1}
weatherSun=\u00a77Ustawiles \u00a7cbezchmurna\u00a77 pogode w\u00a7c {0}\u00a77.
weatherSunFor=\u00a77Ustawiles bezchmurna pogode w\u00a7c {0} \u00a77na {1} sekund.
whoisAFK=\u00a77 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a77 - Zbanowany\:\u00a7r {0}.
whoisExp=\u00a77 - Punkty Doswiadczenia\:\u00a7r {0} (Poziom {1}).
whoisFly=\u00a77 - Latanie\:\u00a7r {0} ({1})

View File

@ -490,6 +490,7 @@ weatherStormFor=\u00A76Definiste o tempo para \u00A7ctempestade\u00A76 em\u00A7c
weatherSun=\u00A76Definiste o tempo para \u00A7csol\u00A76 em\u00A7c {0}\u00A76.
weatherSunFor=\u00A76Definiste o tempo para \u00A7csol\u00A76 em\u00A7c {0} \u00A76por {1} segundos.
whoisAFK=\u00A76 - AFK:\u00A7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00A76 - Banido:\u00A7r {0}
whoisExp=\u00A76 - Exp:\u00A7r {0} (N\u00EDvel {1})
whoisFly=\u00A76 - Modo voo:\u00A7r {0} ({1})

View File

@ -490,6 +490,7 @@ weatherStormFor=\u00A76Voc\u00EA definiu o tempo para \u00A7ctempestade\u00A76 e
weatherSun=\u00A76Voc\u00EA definiu o tempo para \u00A7csol\u00A76 em\u00A7c {0}\u00A76.
weatherSunFor=\u00A76Voc\u00EA definiu o tempo para \u00A7csun\u00A76 em\u00A7c {0} \u00A76por {1} segundos.
whoisAFK=\u00A76 - AFK\:\u00A7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00A76 - Banido\:\u00A7r {0}
whoisExp=\u00A76 - Exp\:\u00A7r {0} (N\u00EDvel {1})
whoisFly=\u00A76 - Modo Fly\:\u00A7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76Ai setat vremea din \u00a7cstorm\u00a76 in\u00a7c {0} \u0
weatherSun=\u00a76Ai setat vremea din \u00a7csun\u00a76 in\u00a7c {0}\u00a76.
weatherSunFor=\u00a76Ai setat vremea din \u00a7csun\u00a76 in\u00a7c {0} \u00a76pentru {1} secunde.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Interzisi\:\u00a7r {0}
whoisExp=\u00a76 - Experience\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Mod zburator\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76\u0412\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u
weatherSun=\u00a76\u0412\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u00a7c\u0441\u043e\u043b\u043d\u0435\u0447\u043d\u0443\u044e\u00a76 \u043f\u043e\u0433\u043e\u0434\u0443 \u0432\u00a7c {0}\u00a76.
weatherSunFor=\u00a76\u0412\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u00a7c\u0441\u043e\u043b\u043d\u0435\u0447\u043d\u0443\u044e\u00a76 \u043f\u043e\u0433\u043e\u0434\u0443 \u0432\u00a7c {0} \u00a76\u043d\u0430 {1} \u0441\u0435\u043a\u0443\u043d\u0434.
whoisAFK=\u00a76 - AFK\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - \u0417\u0430\u0431\u0430\u043d\u0435\u043d\u044b\u0439\:\u00a7r {0}
whoisExp=\u00a76 - \u041e\u043f\u044b\u0442\:\u00a7r {0} (\u0443\u0440\u043e\u0432\u0435\u043d\u044c {1})
whoisFly=\u00a76 - \u0420\u0435\u0436\u0438\u043c \u043f\u043e\u043b\u0435\u0442\u0430\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a77Du har st\u00e4llt in v\u00e4dret till storm i {0} f\u00f
weatherSun=\u00a77Du har st\u00e4llt in v\u00e4dret till sol i {0}
weatherSunFor=\u00a77Du har st\u00e4llt in v\u00e4dret till sol i {0} f\u00f6r {1} sekunder
whoisAFK=\u00a76 - AFK\:\u00a7f {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Bannad\:\u00a7f {0}
whoisExp=\u00a76 - Erfarenhet\:\u00a7f {0} (Level {1})
whoisFly=\u00a76 - Flygl\u00e4ge\:\u00a7f {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76Zaman Degistirlidi
weatherSun=\u00a76Zaman Degistirlidi
weatherSunFor=\u00a76Zaman Degistirildi
whoisAFK=\u00a76 - UZAKTA\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - Banli\:\u00a7r {0}
whoisExp=\u00a76 - EXP\:\u00a7r {0} (Level {1})
whoisFly=\u00a76 - Ucma\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76\u4f60\u5c06 {0} \u7684\u5929\u6c14\u7684\u6539\u4e3a\u96
weatherSun=\u00a76\u4f60\u5c06 {0} \u7684\u5929\u6c14\u6539\u4e3a\u6674\u5929
weatherSunFor=\u00a76\u4f60\u5c06 {0} \u7684\u5929\u6c14\u7684\u6539\u4e3a\u6674\u5929,\u6301\u7eed {1} \u79d2
whoisAFK=\u00a76 - \u6682\u79bb\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - \u5c01\u7981\:\u00a7r {0}
whoisExp=\u00a76 - \u7ecf\u9a8c\:\u00a7r {0} (\u7b49\u7ea7 {1})
whoisFly=\u00a76 - \u98de\u884c\u6a21\u5f0f\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76\u4f60\u5c07 {0} \u7684\u5929\u6c23\u7684\u6539\u70ba\u96
weatherSun=\u00a76\u4f60\u5c07 {0} \u7684\u5929\u6c23\u6539\u70ba\u6674\u5929
weatherSunFor=\u00a76\u4f60\u5c07 {0} \u7684\u5929\u6c23\u7684\u6539\u70ba\u6674\u5929,\u6301\u7e8c {1} \u79d2
whoisAFK=\u00a76 - \u66ab\u96e2\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - \u5c01\u7981\:\u00a7r {0}
whoisExp=\u00a76 - \u7d93\u9a57\:\u00a7r {0} (\u7b49\u7d1a {1})
whoisFly=\u00a76 - \u98db\u884c\u6a21\u5f0f\:\u00a7r {0} ({1})

View File

@ -492,6 +492,7 @@ weatherStormFor=\u00a76\u4f60\u5c07 {0} \u7684\u5929\u6c23\u7684\u6539\u70ba\u96
weatherSun=\u00a76\u4f60\u5c07 {0} \u7684\u5929\u6c23\u6539\u70ba\u6674\u5929
weatherSunFor=\u00a76\u4f60\u5c07 {0} \u7684\u5929\u6c23\u7684\u6539\u70ba\u6674\u5929,\u6301\u7e8c {1} \u79d2
whoisAFK=\u00a76 - \u66ab\u96e2\:\u00a7r {0}
whoisAFKSince=\u00a76 - AFK\:\u00a7r {0} (Since {1})
whoisBanned=\u00a76 - \u5c01\u7981\:\u00a7r {0}
whoisExp=\u00a76 - \u7d93\u9a57\:\u00a7r {0} (\u7b49\u7d1a {1})
whoisFly=\u00a76 - \u98db\u884c\u6a21\u5f0f\:\u00a7r {0} ({1})