From 9ec6d21b936a3d9e49c4c483e0e5306503533d9b Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Wed, 20 Jun 2018 16:30:11 +0300 Subject: [PATCH] NetworkContainer and NetworkKeys objects --- .../store/containers/AnalysisContainer.java | 14 ++++-- .../data/store/containers/DataContainer.java | 21 ++++++++- .../store/containers/NetworkContainer.java | 37 +++++++++++++++ .../plan/data/store/keys/AnalysisKeys.java | 46 +++++++++---------- .../plan/data/store/keys/CommonKeys.java | 7 +++ .../store/keys/CommonPlaceholderKeys.java | 40 ++++++++++++++++ .../plan/data/store/keys/NetworkKeys.java | 44 ++++++++++++++++++ 7 files changed, 180 insertions(+), 29 deletions(-) create mode 100644 Plan/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java create mode 100644 Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonPlaceholderKeys.java create mode 100644 Plan/src/main/java/com/djrapitops/plan/data/store/keys/NetworkKeys.java diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java index c20a02d01..d09cb30d3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java @@ -2,6 +2,7 @@ package com.djrapitops.plan.data.store.containers; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.data.store.Key; +import com.djrapitops.plan.data.store.Type; import com.djrapitops.plan.data.store.keys.AnalysisKeys; import com.djrapitops.plan.data.store.keys.PlayerKeys; import com.djrapitops.plan.data.store.keys.ServerKeys; @@ -43,6 +44,8 @@ public class AnalysisContainer extends DataContainer { private final ServerContainer serverContainer; + private static final Key> serverNames = new Key<>(new Type>() {}, "SERVER_NAMES"); + public AnalysisContainer(ServerContainer serverContainer) { this.serverContainer = serverContainer; addAnalysisSuppliers(); @@ -81,7 +84,9 @@ public class AnalysisContainer extends DataContainer { } private void addServerProperties() { - putSupplier(AnalysisKeys.SERVER_NAME, ServerInfo::getServerName); + putSupplier(AnalysisKeys.SERVER_NAME, () -> + getUnsafe(serverNames).getOrDefault(serverContainer.getUnsafe(ServerKeys.SERVER_UUID), "Plan") + ); ServerProperties serverProperties = ServerInfo.getServerProperties(); putRawData(AnalysisKeys.PLAYERS_MAX, serverProperties.getMaxPlayers()); @@ -178,7 +183,7 @@ public class AnalysisContainer extends DataContainer { putSupplier(AnalysisKeys.PLAYERS_RETAINED_DAY, () -> { try { return getUnsafe(retentionDay); - } catch (IllegalStateException e) { + } catch (IllegalStateException noPlayersAfterDateFiltering) { return 0; } }); @@ -186,7 +191,7 @@ public class AnalysisContainer extends DataContainer { try { Integer playersNewDay = getUnsafe(AnalysisKeys.PLAYERS_NEW_DAY); return playersNewDay != 0 ? Formatters.percentage().apply(1.0 * getUnsafe(retentionDay) / playersNewDay) : "-"; - } catch (IllegalStateException e) { + } catch (IllegalStateException noPlayersAfterDateFiltering) { return "Not enough data"; } }); @@ -194,9 +199,10 @@ public class AnalysisContainer extends DataContainer { private void addSessionSuppliers() { Key sessionAccordion = new Key<>(SessionAccordion.class, "SESSION_ACCORDION"); + putSupplier(serverNames, () -> Database.getActive().fetch().getServerNames()); putSupplier(sessionAccordion, () -> SessionAccordion.forServer( getUnsafe(AnalysisKeys.SESSIONS_MUTATOR).all(), - () -> Database.getActive().fetch().getServerNames(), + getSupplier(serverNames), () -> getUnsafe(AnalysisKeys.PLAYER_NAMES) )); putSupplier(AnalysisKeys.SESSION_ACCORDION_HTML, () -> getUnsafe(sessionAccordion).toHtml()); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java index c73a1a289..fbef41097 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java @@ -33,6 +33,10 @@ public class DataContainer extends HashMap { super.put(key, new CachingSupplier<>(supplier)); } + public Supplier getSupplier(Key key) { + return (Supplier) super.get(key); + } + /** * Check if a Value with the given Key has been placed into the container. * @@ -57,12 +61,12 @@ public class DataContainer extends HashMap { * @return Optional of the object if the key is registered and key matches the type of the object. Otherwise empty. */ public Optional getValue(Key key) { - Supplier supplier = get(key); + Supplier supplier = getSupplier(key); if (supplier == null) { return Optional.empty(); } try { - return Optional.ofNullable((T) supplier.get()); + return Optional.ofNullable(supplier.get()); } catch (ClassCastException e) { return Optional.empty(); } @@ -99,4 +103,17 @@ public class DataContainer extends HashMap { public Supplier put(Key key, Supplier value) { return super.put(key, value); } + + /** + * Normal get method. + * + * @param key Key. + * @return Supplier + * @deprecated Use getSupplier instead for types. + */ + @Override + @Deprecated + public Supplier get(Object key) { + return super.get(key); + } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java new file mode 100644 index 000000000..464c03132 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/NetworkContainer.java @@ -0,0 +1,37 @@ +package com.djrapitops.plan.data.store.containers; + +import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.data.store.keys.NetworkKeys; +import com.djrapitops.plan.data.store.keys.ServerKeys; +import com.djrapitops.plan.data.store.mutators.formatting.Formatters; +import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.utilities.MiscUtils; + +/** + * DataContainer for the whole network. + * + * @author Rsl1122 + * @see com.djrapitops.plan.data.store.keys.NetworkKeys for Key objects + * @see com.djrapitops.plan.data.store.PlaceholderKey for placeholder information + */ +public class NetworkContainer extends DataContainer { + + private final ServerContainer bungeeContainer; + + public NetworkContainer(ServerContainer bungeeContainer) { + this.bungeeContainer = bungeeContainer; + } + + private void addConstants() { + long now = System.currentTimeMillis(); + putRawData(NetworkKeys.REFRESH_TIME, now); + putSupplier(NetworkKeys.REFRESH_TIME_F, () -> Formatters.second().apply(() -> getUnsafe(NetworkKeys.REFRESH_TIME))); + + putRawData(NetworkKeys.VERSION, PlanPlugin.getInstance().getVersion()); + putSupplier(NetworkKeys.TIME_ZONE, MiscUtils::getTimeZoneOffsetHours); + + putSupplier(NetworkKeys.NETWORK_NAME, () -> bungeeContainer.getValue(ServerKeys.NAME).orElse("Plan")); + putSupplier(NetworkKeys.PLAYERS_ONLINE, ServerInfo.getServerProperties()::getOnlinePlayers); + } + +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/keys/AnalysisKeys.java b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/AnalysisKeys.java index 6416b8da8..ef3b0902d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/keys/AnalysisKeys.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/AnalysisKeys.java @@ -24,25 +24,25 @@ import java.util.UUID; public class AnalysisKeys { // Constants (Affected only by config settings) - public static final PlaceholderKey VERSION = new PlaceholderKey<>(String.class, "version"); + public static final PlaceholderKey VERSION = CommonPlaceholderKeys.VERSION; public static final PlaceholderKey SERVER_NAME = new PlaceholderKey<>(String.class, "serverName"); - public static final PlaceholderKey TIME_ZONE = new PlaceholderKey<>(Integer.class, "timeZone"); + public static final PlaceholderKey TIME_ZONE = CommonPlaceholderKeys.TIME_ZONE; public static final PlaceholderKey FIRST_DAY = new PlaceholderKey<>(Integer.class, "firstDay"); public static final PlaceholderKey TPS_MEDIUM = new PlaceholderKey<>(Integer.class, "tpsMedium"); public static final PlaceholderKey TPS_HIGH = new PlaceholderKey<>(Integer.class, "tpsHigh"); public static final PlaceholderKey PLAYERS_MAX = new PlaceholderKey<>(Integer.class, "playersMax"); - public static final PlaceholderKey PLAYERS_ONLINE = new PlaceholderKey<>(Integer.class, "playersOnline"); - public static final PlaceholderKey PLAYERS_TOTAL = new PlaceholderKey<>(Integer.class, "playersTotal"); + public static final PlaceholderKey PLAYERS_ONLINE = CommonPlaceholderKeys.PLAYERS_ONLINE; + public static final PlaceholderKey PLAYERS_TOTAL = CommonPlaceholderKeys.PLAYERS_TOTAL; // public static final PlaceholderKey WORLD_PIE_COLORS = new PlaceholderKey<>(String.class, "worldPieColors"); public static final PlaceholderKey GM_PIE_COLORS = new PlaceholderKey<>(String.class, "gmPieColors"); public static final PlaceholderKey ACTIVITY_PIE_COLORS = new PlaceholderKey<>(String.class, "activityPieColors"); - public static final PlaceholderKey PLAYERS_GRAPH_COLOR = new PlaceholderKey<>(String.class, "playersGraphColor"); + public static final PlaceholderKey PLAYERS_GRAPH_COLOR = CommonPlaceholderKeys.PLAYERS_GRAPH_COLOR; public static final PlaceholderKey TPS_HIGH_COLOR = new PlaceholderKey<>(String.class, "tpsHighColor"); public static final PlaceholderKey TPS_MEDIUM_COLOR = new PlaceholderKey<>(String.class, "tpsMediumColor"); public static final PlaceholderKey TPS_LOW_COLOR = new PlaceholderKey<>(String.class, "tpsLowColor"); - public static final PlaceholderKey WORLD_MAP_HIGH_COLOR = new PlaceholderKey<>(String.class, "worldMapColHigh"); - public static final PlaceholderKey WORLD_MAP_LOW_COLOR = new PlaceholderKey<>(String.class, "worldMapColLow"); + public static final PlaceholderKey WORLD_MAP_HIGH_COLOR = CommonPlaceholderKeys.WORLD_MAP_HIGH_COLOR; + public static final PlaceholderKey WORLD_MAP_LOW_COLOR = CommonPlaceholderKeys.WORLD_MAP_LOW_COLOR; // Tables & other structures public static final PlaceholderKey PLAYERS_TABLE = new PlaceholderKey<>(String.class, "tablePlayerlist"); public static final PlaceholderKey SESSION_ACCORDION_HTML = new PlaceholderKey<>(String.class, "accordionSessions"); @@ -54,15 +54,15 @@ public class AnalysisKeys { public static final PlaceholderKey PLUGINS_TAB = new PlaceholderKey<>(String.class, "navPluginsTabs"); public static final PlaceholderKey PLUGINS_TAB_NAV = new PlaceholderKey<>(String.class, "tabsPlugins"); // Formatted time values - public static final PlaceholderKey REFRESH_TIME_F = new PlaceholderKey<>(String.class, "refresh"); - public static final PlaceholderKey LAST_PEAK_TIME_F = new PlaceholderKey<>(String.class, "lastPeakTime"); - public static final PlaceholderKey ALL_TIME_PEAK_TIME_F = new PlaceholderKey<>(String.class, "bestPeakTime"); + public static final PlaceholderKey REFRESH_TIME_F = CommonPlaceholderKeys.REFRESH_TIME_F; + public static final PlaceholderKey LAST_PEAK_TIME_F = CommonPlaceholderKeys.LAST_PEAK_TIME_F; + public static final PlaceholderKey ALL_TIME_PEAK_TIME_F = CommonPlaceholderKeys.ALL_TIME_PEAK_TIME_F; public static final PlaceholderKey AVERAGE_SESSION_LENGTH_F = new PlaceholderKey<>(String.class, "sessionAverage"); public static final PlaceholderKey AVERAGE_PLAYTIME_F = new PlaceholderKey<>(String.class, "playtimeAverage"); public static final PlaceholderKey PLAYTIME_F = new PlaceholderKey<>(String.class, "playtimeTotal"); // Direct values, possibly formatted - public static final PlaceholderKey PLAYERS_LAST_PEAK = new PlaceholderKey<>(String.class, "playersLastPeak"); - public static final PlaceholderKey PLAYERS_ALL_TIME_PEAK = new PlaceholderKey<>(String.class, "playersBestPeak"); + public static final PlaceholderKey PLAYERS_LAST_PEAK = CommonPlaceholderKeys.PLAYERS_LAST_PEAK; + public static final PlaceholderKey PLAYERS_ALL_TIME_PEAK = CommonPlaceholderKeys.PLAYERS_ALL_TIME_PEAK; public static final PlaceholderKey OPERATORS = new PlaceholderKey<>(Integer.class, "ops"); public static final PlaceholderKey PLAYERS_REGULAR = new PlaceholderKey<>(Integer.class, "playersRegular"); public static final PlaceholderKey SESSION_COUNT = new PlaceholderKey<>(Integer.class, "sessionCount"); @@ -73,12 +73,12 @@ public class AnalysisKeys { public static final PlaceholderKey COMMAND_COUNT = new PlaceholderKey<>(Integer.class, "commandCount"); public static final PlaceholderKey COMMAND_COUNT_UNIQUE = new PlaceholderKey<>(Integer.class, "commandUniqueCount"); // - public static final PlaceholderKey PLAYERS_DAY = new PlaceholderKey<>(Integer.class, "playersDay"); - public static final PlaceholderKey PLAYERS_WEEK = new PlaceholderKey<>(Integer.class, "playersWeek"); - public static final PlaceholderKey PLAYERS_MONTH = new PlaceholderKey<>(Integer.class, "playersMonth"); - public static final PlaceholderKey PLAYERS_NEW_DAY = new PlaceholderKey<>(Integer.class, "playersNewDay"); - public static final PlaceholderKey PLAYERS_NEW_WEEK = new PlaceholderKey<>(Integer.class, "playersNewWeek"); - public static final PlaceholderKey PLAYERS_NEW_MONTH = new PlaceholderKey<>(Integer.class, "playersNewMonth"); + public static final PlaceholderKey PLAYERS_DAY = CommonPlaceholderKeys.PLAYERS_DAY; + public static final PlaceholderKey PLAYERS_WEEK = CommonPlaceholderKeys.PLAYERS_WEEK; + public static final PlaceholderKey PLAYERS_MONTH = CommonPlaceholderKeys.PLAYERS_MONTH; + public static final PlaceholderKey PLAYERS_NEW_DAY = CommonPlaceholderKeys.PLAYERS_NEW_DAY; + public static final PlaceholderKey PLAYERS_NEW_WEEK = CommonPlaceholderKeys.PLAYERS_NEW_WEEK; + public static final PlaceholderKey PLAYERS_NEW_MONTH = CommonPlaceholderKeys.PLAYERS_NEW_MONTH; public static final PlaceholderKey AVG_PLAYERS = new PlaceholderKey<>(Integer.class, "playersAverage"); public static final PlaceholderKey AVG_PLAYERS_DAY = new PlaceholderKey<>(Integer.class, "playersAverageDay"); public static final PlaceholderKey AVG_PLAYERS_WEEK = new PlaceholderKey<>(Integer.class, "playersAverageWeek"); @@ -115,22 +115,22 @@ public class AnalysisKeys { // Data for Charts public static final PlaceholderKey WORLD_PIE_SERIES = new PlaceholderKey<>(String.class, "worldSeries"); public static final PlaceholderKey GM_PIE_SERIES = new PlaceholderKey<>(String.class, "gmSeries"); - public static final PlaceholderKey PLAYERS_ONLINE_SERIES = new PlaceholderKey<>(String.class, "playersOnlineSeries"); + public static final PlaceholderKey PLAYERS_ONLINE_SERIES = CommonPlaceholderKeys.PLAYERS_ONLINE_SERIES; public static final PlaceholderKey TPS_SERIES = new PlaceholderKey<>(String.class, "tpsSeries"); public static final PlaceholderKey CPU_SERIES = new PlaceholderKey<>(String.class, "cpuSeries"); public static final PlaceholderKey RAM_SERIES = new PlaceholderKey<>(String.class, "ramSeries"); public static final PlaceholderKey ENTITY_SERIES = new PlaceholderKey<>(String.class, "entitySeries"); public static final PlaceholderKey CHUNK_SERIES = new PlaceholderKey<>(String.class, "chunkSeries"); public static final PlaceholderKey PUNCHCARD_SERIES = new PlaceholderKey<>(String.class, "punchCardSeries"); - public static final PlaceholderKey WORLD_MAP_SERIES = new PlaceholderKey<>(String.class, "geoMapSeries"); + public static final PlaceholderKey WORLD_MAP_SERIES = CommonPlaceholderKeys.WORLD_MAP_SERIES; public static final PlaceholderKey ACTIVITY_STACK_SERIES = new PlaceholderKey<>(String.class, "activityStackSeries"); public static final PlaceholderKey ACTIVITY_STACK_CATEGORIES = new PlaceholderKey<>(String.class, "activityStackCategories"); public static final PlaceholderKey ACTIVITY_PIE_SERIES = new PlaceholderKey<>(String.class, "activityPieSeries"); public static final PlaceholderKey CALENDAR_SERIES = new PlaceholderKey<>(String.class, "calendarSeries"); // Variables used only during analysis - public static final Key SESSIONS_MUTATOR = new Key<>(SessionsMutator.class, "SESSIONS_MUTATOR"); - public static final Key TPS_MUTATOR = new Key<>(TPSMutator.class, "TPS_MUTATOR"); - public static final Key PLAYERS_MUTATOR = new Key<>(PlayersMutator.class, "PLAYERS_MUTATOR"); + public static final Key SESSIONS_MUTATOR = CommonKeys.SESSIONS_MUTATOR; + public static final Key TPS_MUTATOR = CommonKeys.TPS_MUTATOR; + public static final Key PLAYERS_MUTATOR = CommonKeys.PLAYERS_MUTATOR; public static final Key PLAYERS_ONLINE_RESOLVER = new Key<>(PlayersOnlineResolver.class, "PLAYERS_ONLINE_RESOLVER"); public static final Key PLAYTIME_TOTAL = new Key<>(Long.class, "PLAYTIME_TOTAL"); public static final Key ANALYSIS_TIME = new Key<>(Long.class, "ANALYSIS_TIME"); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonKeys.java b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonKeys.java index b0450a5d6..19efaa924 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonKeys.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonKeys.java @@ -4,6 +4,9 @@ import com.djrapitops.plan.data.container.PlayerKill; import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.store.Key; import com.djrapitops.plan.data.store.Type; +import com.djrapitops.plan.data.store.mutators.PlayersMutator; +import com.djrapitops.plan.data.store.mutators.SessionsMutator; +import com.djrapitops.plan.data.store.mutators.TPSMutator; import com.djrapitops.plan.data.time.WorldTimes; import java.util.List; @@ -37,4 +40,8 @@ public class CommonKeys { public static final Key BANNED = new Key<>(Boolean.class, "banned"); public static final Key OPERATOR = new Key<>(Boolean.class, "operator"); + public static final Key SESSIONS_MUTATOR = new Key<>(SessionsMutator.class, "SESSIONS_MUTATOR"); + public static final Key TPS_MUTATOR = new Key<>(TPSMutator.class, "TPS_MUTATOR"); + public static final Key PLAYERS_MUTATOR = new Key<>(PlayersMutator.class, "PLAYERS_MUTATOR"); + } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonPlaceholderKeys.java b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonPlaceholderKeys.java new file mode 100644 index 000000000..07a6589b2 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/CommonPlaceholderKeys.java @@ -0,0 +1,40 @@ +package com.djrapitops.plan.data.store.keys; + +import com.djrapitops.plan.data.store.PlaceholderKey; + +/** + * Similar to {@link CommonKeys}, but for {@link com.djrapitops.plan.data.store.PlaceholderKey}s. + * + * @author Rsl1122 + * @see com.djrapitops.plan.data.store.PlaceholderKey for placeholder information + */ +class CommonPlaceholderKeys { + + static final PlaceholderKey VERSION = new PlaceholderKey<>(String.class, "version"); + static final PlaceholderKey TIME_ZONE = new PlaceholderKey<>(Integer.class, "timeZone"); + static final PlaceholderKey PLAYERS_GRAPH_COLOR = new PlaceholderKey<>(String.class, "playersGraphColor"); + static final PlaceholderKey PLAYERS_ONLINE_SERIES = new PlaceholderKey<>(String.class, "playersOnlineSeries"); + static final PlaceholderKey WORLD_MAP_HIGH_COLOR = new PlaceholderKey<>(String.class, "worldMapColHigh"); + static final PlaceholderKey WORLD_MAP_LOW_COLOR = new PlaceholderKey<>(String.class, "worldMapColLow"); + static final PlaceholderKey PLAYERS_ONLINE = new PlaceholderKey<>(Integer.class, "playersOnline"); + static final PlaceholderKey PLAYERS_TOTAL = new PlaceholderKey<>(Integer.class, "playersTotal"); + static final PlaceholderKey WORLD_MAP_SERIES = new PlaceholderKey<>(String.class, "geoMapSeries"); + + static final PlaceholderKey PLAYERS_DAY = new PlaceholderKey<>(Integer.class, "playersDay"); + static final PlaceholderKey PLAYERS_WEEK = new PlaceholderKey<>(Integer.class, "playersWeek"); + static final PlaceholderKey PLAYERS_MONTH = new PlaceholderKey<>(Integer.class, "playersMonth"); + static final PlaceholderKey PLAYERS_NEW_DAY = new PlaceholderKey<>(Integer.class, "playersNewDay"); + static final PlaceholderKey PLAYERS_NEW_WEEK = new PlaceholderKey<>(Integer.class, "playersNewWeek"); + static final PlaceholderKey PLAYERS_NEW_MONTH = new PlaceholderKey<>(Integer.class, "playersNewMonth"); + + static final PlaceholderKey REFRESH_TIME_F = new PlaceholderKey<>(String.class, "refresh"); + static final PlaceholderKey LAST_PEAK_TIME_F = new PlaceholderKey<>(String.class, "lastPeakTime"); + static final PlaceholderKey ALL_TIME_PEAK_TIME_F = new PlaceholderKey<>(String.class, "bestPeakTime"); + static final PlaceholderKey PLAYERS_LAST_PEAK = new PlaceholderKey<>(String.class, "playersLastPeak"); + static final PlaceholderKey PLAYERS_ALL_TIME_PEAK = new PlaceholderKey<>(String.class, "playersBestPeak"); + + private CommonPlaceholderKeys() { + /* static variable class */ + } + +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/keys/NetworkKeys.java b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/NetworkKeys.java new file mode 100644 index 000000000..b9ba2d12d --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/keys/NetworkKeys.java @@ -0,0 +1,44 @@ +package com.djrapitops.plan.data.store.keys; + +import com.djrapitops.plan.data.store.Key; +import com.djrapitops.plan.data.store.PlaceholderKey; + +/** + * Key objects for {@link com.djrapitops.plan.data.store.containers.NetworkContainer}. + * + * @author Rsl1122 + * @see com.djrapitops.plan.data.store.containers.NetworkContainer for DataContainer. + */ +public class NetworkKeys { + + public static final PlaceholderKey VERSION = CommonPlaceholderKeys.VERSION; + public static final PlaceholderKey NETWORK_NAME = new PlaceholderKey<>(String.class, "networkName"); + public static final PlaceholderKey TIME_ZONE = CommonPlaceholderKeys.TIME_ZONE; + public static final PlaceholderKey PLAYERS_ONLINE = CommonPlaceholderKeys.PLAYERS_ONLINE; + public static final PlaceholderKey PLAYERS_TOTAL = CommonPlaceholderKeys.PLAYERS_TOTAL; + public static final PlaceholderKey PLAYERS_GRAPH_COLOR = CommonPlaceholderKeys.PLAYERS_GRAPH_COLOR; + public static final PlaceholderKey WORLD_MAP_HIGH_COLOR = CommonPlaceholderKeys.WORLD_MAP_HIGH_COLOR; + public static final PlaceholderKey WORLD_MAP_LOW_COLOR = CommonPlaceholderKeys.WORLD_MAP_LOW_COLOR; + + public static final PlaceholderKey REFRESH_TIME_F = CommonPlaceholderKeys.REFRESH_TIME_F; + public static final PlaceholderKey LAST_PEAK_TIME_F = CommonPlaceholderKeys.LAST_PEAK_TIME_F; + public static final PlaceholderKey ALL_TIME_PEAK_TIME_F = CommonPlaceholderKeys.ALL_TIME_PEAK_TIME_F; + public static final PlaceholderKey PLAYERS_LAST_PEAK = CommonPlaceholderKeys.PLAYERS_LAST_PEAK; + public static final PlaceholderKey PLAYERS_ALL_TIME_PEAK = CommonPlaceholderKeys.PLAYERS_ALL_TIME_PEAK; + public static final PlaceholderKey PLAYERS_DAY = CommonPlaceholderKeys.PLAYERS_DAY; + public static final PlaceholderKey PLAYERS_WEEK = CommonPlaceholderKeys.PLAYERS_WEEK; + public static final PlaceholderKey PLAYERS_MONTH = CommonPlaceholderKeys.PLAYERS_MONTH; + public static final PlaceholderKey PLAYERS_NEW_DAY = CommonPlaceholderKeys.PLAYERS_NEW_DAY; + public static final PlaceholderKey PLAYERS_NEW_WEEK = CommonPlaceholderKeys.PLAYERS_NEW_WEEK; + public static final PlaceholderKey PLAYERS_NEW_MONTH = CommonPlaceholderKeys.PLAYERS_NEW_MONTH; + + public static final PlaceholderKey WORLD_MAP_SERIES = CommonPlaceholderKeys.WORLD_MAP_SERIES; + public static final PlaceholderKey PLAYERS_ONLINE_SERIES = CommonPlaceholderKeys.PLAYERS_ONLINE_SERIES; + + public static final Key REFRESH_TIME = new Key<>(Long.class, "REFRESH_TIME"); + + private NetworkKeys() { + /* static variable class */ + } + +} \ No newline at end of file