diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java index 1fb7ca6dd..d53f2e8b0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java @@ -25,15 +25,6 @@ public class AnalysisUtils { throw new IllegalStateException("Utility class"); } - @Deprecated - public static boolean isActive(long now, long lastPlayed, long playTime, long loginTimes) { - int timeToActive = 10; - long twoWeeks = 1209600000; - return now - lastPlayed < twoWeeks - && loginTimes > 3 - && playTime > 60 * timeToActive; - } - public static long getNewPlayers(List registered, long scale, long now) { long newPlayers = 0; if (!registered.isEmpty()) { @@ -46,38 +37,6 @@ public class AnalysisUtils { return newPlayers; } - @Deprecated - public static List transformSessionDataToLengths(Collection data) { - return data.stream() - .filter(Objects::nonNull) - .filter(session -> session.getLength() > 0) - .map(Session::getLength) - .collect(Collectors.toList()); - } - - /** - * Used to calculate unique players that have played within the time frame determined by scale. - * - * @param sessions All sessions sorted in a map by User's UUID - * @param scale Scale (milliseconds), time before (Current epoch - scale) will be ignored. - * @return Amount of Unique joins within the time span. - */ - @Deprecated - public static int getUniqueJoins(Map> sessions, long scale) { - long now = MiscUtils.getTime(); - long nowMinusScale = now - scale; - - Set uniqueJoins = new HashSet<>(); - sessions.forEach((uuid, s) -> - s.stream() - .filter(session -> session.getSessionStart() >= nowMinusScale) - .map(session -> uuid) - .forEach(uniqueJoins::add) - ); - - return uniqueJoins.size(); - } - public static int getUniqueJoinsPerDay(Map> sessions, long after) { Map> uniqueJoins = new HashMap<>(); @@ -176,26 +135,6 @@ public class AnalysisUtils { return value; } - @Deprecated - public static long getTotalPlaytime(List sessions) { - return sessions.stream().mapToLong(Session::getLength).sum(); - } - - @Deprecated - public static long getLongestSessionLength(List sessions) { - Optional longest = sessions.stream().sorted(new SessionLengthComparator()).findFirst(); - return longest.map(Session::getLength).orElse(0L); - } - - @Deprecated - public static long getLastSeen(List userSessions) { - OptionalLong max = userSessions.stream().mapToLong(Session::getSessionEnd).max(); - if (max.isPresent()) { - return max.getAsLong(); - } - return 0; - } - public static void addMissingWorlds(WorldTimes worldTimes) { try { // Add 0 time for worlds not present. diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java index f6b141291..97796d60e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java @@ -60,40 +60,6 @@ public class HtmlStructure { return builder.toString(); } - @Deprecated - public static String createServerOverviewColumn(Map> sessions) { - StringBuilder builder = new StringBuilder("
"); - if (Verify.isEmpty(sessions)) { - return "

No Sessions

" + - "

No sessions to calculate server specific playtime.

"; - } - for (Map.Entry> entry : sessions.entrySet()) { - String serverName = entry.getKey(); - List serverSessions = entry.getValue(); - - // Header - builder.append("

").append(serverName).append("

"); - - // White box - builder.append("
"); - - // Content - builder.append("

Sessions: ").append(serverSessions.size()).append("
"); - long playTime = AnalysisUtils.getTotalPlaytime(serverSessions); - builder.append("Playtime: ").append(FormatUtils.formatTimeAmount(playTime)).append("
"); - builder.append("
"); - long longestSessionLength = AnalysisUtils.getLongestSessionLength(serverSessions); - builder.append("Longest Session: ").append(FormatUtils.formatTimeAmount(longestSessionLength)); - - // Content and box end - builder.append("

"); - - } - // Column ends - builder.append("
"); - return builder.toString(); - } - public static String[] createSessionsTabContentInspectPage(Map> sessions, List allSessions, UUID uuid) { if (Settings.DISPLAY_SESSIONS_AS_TABLE.isTrue()) { Map> sessionsByPlayer = new HashMap<>(); diff --git a/Plan/test/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtilsTest.java b/Plan/test/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtilsTest.java index a3e90a201..aef6e4a78 100644 --- a/Plan/test/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtilsTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtilsTest.java @@ -31,46 +31,6 @@ public class AnalysisUtilsTest { TestInit.init(); } - @Test - public void testIsActive() { - long lastPlayed = MiscUtils.getTime(); - long playTime = 12638934876L; - int loginTimes = 4; - - boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes); - assertEquals(true, result); - } - - @Test - public void testIsNotActive2() { - long lastPlayed = MiscUtils.getTime(); - long playTime = 0L; - int loginTimes = 4; - - boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes); - assertEquals(false, result); - } - - @Test - public void testIsNotActive3() { - long lastPlayed = MiscUtils.getTime(); - long playTime = 12638934876L; - int loginTimes = 0; - - boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes); - assertEquals(false, result); - } - - @Test - public void testIsNotActive() { - long lastPlayed = 0L; - long playTime = 12638934876L; - int loginTimes = 4; - - boolean result = AnalysisUtils.isActive(System.currentTimeMillis(), lastPlayed, playTime, loginTimes); - assertEquals(false, result); - } - @Test public void testGetNewPlayers() { List registered = Arrays.asList(5L, 1L); @@ -90,17 +50,4 @@ public class AnalysisUtilsTest { assertEquals(0L, result); } - - @Test - public void testTransformSessionDataToLengths() { - Collection data = Arrays.asList( - new Session(1, 0L, 5L, 0, 0), - new Session(1, 0L, 20L, 0, 0) - ); - - List expResult = Arrays.asList(5L, 20L); - List result = AnalysisUtils.transformSessionDataToLengths(data); - - assertEquals(expResult, result); - } } diff --git a/Plan/test/main/java/com/djrapitops/plan/utilities/html/HtmlStructureTest.java b/Plan/test/main/java/com/djrapitops/plan/utilities/html/HtmlStructureTest.java index d7fbcaa41..b5808c90c 100644 --- a/Plan/test/main/java/com/djrapitops/plan/utilities/html/HtmlStructureTest.java +++ b/Plan/test/main/java/com/djrapitops/plan/utilities/html/HtmlStructureTest.java @@ -31,14 +31,4 @@ public class HtmlStructureTest { sessions.put(RandomData.randomString(10), RandomData.randomSessions()); } } - - @Test - public void createServerOverviewColumn() throws Exception { - String serverOverviewColumn = HtmlStructure.createServerOverviewColumn(sessions); - - int opened = StringUtils.countMatches(serverOverviewColumn, " warpsList = new ArrayList<>(essentials.getWarps().getList()); if (!warpsList.isEmpty()) { TableContainer warps = new TableContainer(getWithIcon("Warp", "map-marker"), getWithIcon("Command", "terminal")); diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/towny/TownyData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/towny/TownyData.java index 45e5aa66d..280848a8d 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/towny/TownyData.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/towny/TownyData.java @@ -70,8 +70,9 @@ public class TownyData extends PluginData { public AnalysisContainer getServerData(Collection collection, AnalysisContainer analysisContainer) throws Exception { List towns = getTopTowns(); + analysisContainer.addValue(getWithIcon("Number of Towns", "bank", "brown"), towns.size()); + if (!towns.isEmpty()) { - analysisContainer.addValue(getWithIcon("Number of Towns", "bank", "brown"), towns.size()); Map userTowns = new HashMap<>(); for (Town town : towns) {