Fix last seen variable

This commit is contained in:
Nick Porillo 2015-05-12 23:14:51 -04:00
parent 6921dd1796
commit aeef4d69c2
2 changed files with 5 additions and 8 deletions

View File

@ -47,6 +47,7 @@ public class FCmdRoot extends FCommand {
public CmdSethome cmdSethome = new CmdSethome(); public CmdSethome cmdSethome = new CmdSethome();
public CmdShow cmdShow = new CmdShow(); public CmdShow cmdShow = new CmdShow();
public CmdStatus cmdStatus = new CmdStatus(); public CmdStatus cmdStatus = new CmdStatus();
public CmdStuck cmdStuck = new CmdStuck();
public CmdTag cmdTag = new CmdTag(); public CmdTag cmdTag = new CmdTag();
public CmdTitle cmdTitle = new CmdTitle(); public CmdTitle cmdTitle = new CmdTitle();
public CmdToggleAllianceChat cmdToggleAllianceChat = new CmdToggleAllianceChat(); public CmdToggleAllianceChat cmdToggleAllianceChat = new CmdToggleAllianceChat();
@ -125,10 +126,11 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdRelationNeutral); this.addSubCommand(this.cmdRelationNeutral);
this.addSubCommand(this.cmdReload); this.addSubCommand(this.cmdReload);
this.addSubCommand(this.cmdSafeunclaimall); this.addSubCommand(this.cmdSafeunclaimall);
this.addSubCommand(this.cmdSaveAll); this.addSubCommand(this.cmdSaveAll);
this.addSubCommand(this.cmdSethome); this.addSubCommand(this.cmdSethome);
this.addSubCommand(this.cmdShow); this.addSubCommand(this.cmdShow);
this.addSubCommand(this.cmdStatus); this.addSubCommand(this.cmdStatus);
this.addSubCommand(this.cmdStuck);
this.addSubCommand(this.cmdTag); this.addSubCommand(this.cmdTag);
this.addSubCommand(this.cmdTitle); this.addSubCommand(this.cmdTitle);
this.addSubCommand(this.cmdUnclaim); this.addSubCommand(this.cmdUnclaim);

View File

@ -6,7 +6,6 @@ import com.massivecraft.factions.struct.Relation;
import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.lang.time.DurationFormatUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -139,12 +138,8 @@ public enum TagReplacer {
case FACTION: case FACTION:
return !fac.isNone() ? fac.getTag(fp) : TL.GENERIC_FACTIONLESS.toString(); return !fac.isNone() ? fac.getTag(fp) : TL.GENERIC_FACTIONLESS.toString();
case LAST_SEEN: case LAST_SEEN:
long lastSeen = System.currentTimeMillis() - fp.getLastLoginTime(); String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
String humanized = DurationFormatUtils.formatDurationWords(lastSeen, true, true) + TL.COMMAND_STATUS_AGOSUFFIX; return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() :
(lastSeen < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
return String.format(TL.COMMAND_STATUS_FORMAT.toString(),
ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, last).trim();
case PLAYER_GROUP: case PLAYER_GROUP:
return P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fp.getId()))); return P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fp.getId())));
case PLAYER_BALANCE: case PLAYER_BALANCE: