From 29a0b68dcbe13dca3b0a95f8842a7c02af47c575 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 27 Jun 2016 23:59:38 +1000 Subject: [PATCH] Fix currently online for seen info. --- .../intellectualcrafters/plot/config/C.java | 1 + .../plot/util/MainUtil.java | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index d60bb951a..9116f88b7 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -454,6 +454,7 @@ public enum C { * Info */ NONE("None", "Info"), + NOW("Now", "Info"), NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"), EVERYONE("Everyone", "Info"), diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 342c04d2e..d0f4433a1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -719,10 +719,18 @@ public class MainUtil { String trusted = getPlayerList(plot.getTrusted()); String members = getPlayerList(plot.getMembers()); String denied = getPlayerList(plot.getDenied()); - String seen = C.UNKNOWN.s(); + String seen; if (Settings.Enabled_Components.PLOT_EXPIRY) { - int time = (int) (ExpireManager.IMP.getAge(plot) / 1000); - seen = MainUtil.secToTime(time); + if (plot.isOnline()) { + seen = C.NOW.s(); + } else { + int time = (int) (ExpireManager.IMP.getAge(plot) / 1000); + if (time != 0) { + seen = MainUtil.secToTime(time); + } else { + seen = C.UNKNOWN.s(); + } + } } else { seen = C.NEVER.s(); } @@ -741,9 +749,7 @@ public class MainUtil { } } boolean build = plot.isAdded(player.getUUID()); - String owner = plot.getOwners().isEmpty() ? "unowned" : getPlayerList(plot.getOwners()); - info = info.replace("%id%", plot.getId().toString()); info = info.replace("%alias%", alias); info = info.replace("%num%", String.valueOf(num)); @@ -771,10 +777,6 @@ public class MainUtil { String info; if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) { double[] ratings = MainUtil.getAverageRatings(plot); - for (double v : ratings) { - - } - String rating = ""; String prefix = ""; for (int i = 0; i < ratings.length; i++) {