Skip to content
Merged
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
6 changes: 6 additions & 0 deletions Essentials/src/main/java/com/earth2me/essentials/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
private long lastHomeConfirmationTimestamp;
private Boolean toggleShout;
private transient final List<String> signCopy = Lists.newArrayList("", "", "", "");
private transient long lastVanishTime = System.currentTimeMillis();

public User(final Player base, final IEssentials ess) {
super(base, ess);
Expand Down Expand Up @@ -964,6 +965,7 @@ public void setVanished(final boolean set) {
}
}
setHidden(true);
lastVanishTime = System.currentTimeMillis();
ess.getVanishedPlayersNew().add(getName());
this.getBase().setMetadata("vanished", new FixedMetadataValue(ess, true));
if (isAuthorized("essentials.vanish.effect")) {
Expand Down Expand Up @@ -1190,6 +1192,10 @@ public boolean isBaltopExempt() {
return isBaltopExcludeCache();
}

public long getLastVanishTime() {
return lastVanishTime;
}

@Override
public Block getTargetBlock(int maxDistance) {
final Block block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;

import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.DateUtil;
import com.earth2me.essentials.utils.EnumUtil;
import com.earth2me.essentials.utils.VersionUtil;
Expand Down Expand Up @@ -39,9 +40,12 @@ protected void run(Server server, CommandSource sender, String commandLabel, Str
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_15_2_R01)) {
throw e;
}
final IUser user = getPlayer(server, sender, args, 0, true);
displayName = user.getName();
final User user = getPlayer(server, args, 0, true, true);
displayName = user.getName(); // Vanished players will have their name as their display name
playtime = Bukkit.getOfflinePlayer(user.getBase().getUniqueId()).getStatistic(PLAY_ONE_TICK);
if (user.getBase().isOnline() && user.isVanished()) {
playtime = playtime - ((System.currentTimeMillis() - user.getLastVanishTime()) / 50L);
}
}
key = "playtimeOther";
} else if (sender.isPlayer()) {
Expand Down