public void checkActivity() { final long autoafkkick = ess.getSettings().getAutoAfkKick(); if (autoafkkick > 0 && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis() && !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt")) { final String kickReason = tl("autoAfkKickReason", autoafkkick / 60.0); lastActivity = 0; this.getBase().kickPlayer(kickReason); for (User user : ess.getOnlineUsers()) { if (user.isAuthorized("essentials.kick.notify")) { user.sendMessage(tl("playerKicked", Console.NAME, getName(), kickReason)); } } } final long autoafk = ess.getSettings().getAutoAfk(); if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk.auto")) { setAfk(true); if (!isHidden()) { setDisplayNick(); final String msg = tl("userIsAway", getDisplayName()); if (!msg.isEmpty()) { ess.broadcastMessage(this, msg); } } } }
@Override public String getDisplayName() { if (!(base instanceof OfflinePlayer) && ess.getSettings().changeDisplayName()) { setDisplayNick(getNick()); } return super.getDisplayName() == null ? super.getName() : super.getDisplayName(); }
public void updateActivity(final boolean broadcast) { if (isAfk() && ess.getSettings().cancelAfkOnInteract()) { setAfk(false); if (broadcast && !isHidden()) { setDisplayNick(); final String msg = tl("userIsNotAway", getDisplayName()); if (!msg.isEmpty()) { ess.broadcastMessage(this, msg); } } } lastActivity = System.currentTimeMillis(); }