4444import com .djrapitops .plan .settings .config .paths .DataGatheringSettings ;
4545import com .djrapitops .plan .settings .config .paths .DisplaySettings ;
4646import com .djrapitops .plan .settings .config .paths .TimeSettings ;
47- import com .djrapitops .plan .settings .locale .Locale ;
4847import com .djrapitops .plan .settings .locale .lang .GenericLang ;
4948import com .djrapitops .plan .settings .theme .Theme ;
5049import com .djrapitops .plan .settings .theme .ThemeVal ;
7675public class GraphJSONCreator {
7776
7877 private final PlanConfig config ;
79- private final Locale locale ;
8078 private final Theme theme ;
8179 private final DBSystem dbSystem ;
8280 private final Graphs graphs ;
8381
8482 @ Inject
8583 public GraphJSONCreator (
8684 PlanConfig config ,
87- Locale locale ,
8885 Theme theme ,
8986 DBSystem dbSystem ,
9087 Graphs graphs
9188 ) {
9289 this .config = config ;
93- this .locale = locale ;
9490 this .theme = theme ;
9591 this .dbSystem = dbSystem ;
9692 this .graphs = graphs ;
@@ -111,14 +107,14 @@ public String performanceGraphJSON(ServerUUID serverUUID) {
111107 ",\" chunks\" :" + lineGraphs .chunkGraph (tpsMutator ).toHighChartsSeries () +
112108 ",\" disk\" :" + lineGraphs .diskGraph (tpsMutator ).toHighChartsSeries () +
113109 ",\" colors\" :{" +
114- "\" playersOnline\" :\" " + theme . getValue ( ThemeVal .GRAPH_PLAYERS_ONLINE ) + "\" ," +
115- "\" cpu\" :\" " + theme . getValue ( ThemeVal .GRAPH_CPU ) + "\" ," +
116- "\" ram\" :\" " + theme . getValue ( ThemeVal .GRAPH_RAM ) + "\" ," +
117- "\" entities\" :\" " + theme . getValue ( ThemeVal .GRAPH_ENTITIES ) + "\" ," +
118- "\" chunks\" :\" " + theme . getValue ( ThemeVal .GRAPH_CHUNKS ) + "\" ," +
119- "\" low\" :\" " + theme . getValue ( ThemeVal .GRAPH_TPS_LOW ) + "\" ," +
120- "\" med\" :\" " + theme . getValue ( ThemeVal .GRAPH_TPS_MED ) + "\" ," +
121- "\" high\" :\" " + theme . getValue ( ThemeVal .GRAPH_TPS_HIGH ) + "\" }" +
110+ "\" playersOnline\" :\" " + ThemeVal .GRAPH_PLAYERS_ONLINE . getDefaultValue ( ) + "\" ," +
111+ "\" cpu\" :\" " + ThemeVal .GRAPH_CPU . getDefaultValue ( ) + "\" ," +
112+ "\" ram\" :\" " + ThemeVal .GRAPH_RAM . getDefaultValue ( ) + "\" ," +
113+ "\" entities\" :\" " + ThemeVal .GRAPH_ENTITIES . getDefaultValue ( ) + "\" ," +
114+ "\" chunks\" :\" " + ThemeVal .GRAPH_CHUNKS . getDefaultValue ( ) + "\" ," +
115+ "\" low\" :\" " + ThemeVal .GRAPH_TPS_LOW . getDefaultValue ( ) + "\" ," +
116+ "\" med\" :\" " + ThemeVal .GRAPH_TPS_MED . getDefaultValue ( ) + "\" ," +
117+ "\" high\" :\" " + ThemeVal .GRAPH_TPS_HIGH . getDefaultValue ( ) + "\" }" +
122118 ",\" zones\" :{" +
123119 "\" tpsThresholdMed\" :" + config .get (DisplaySettings .GRAPH_TPS_THRESHOLD_MED ) + ',' +
124120 "\" tpsThresholdHigh\" :" + config .get (DisplaySettings .GRAPH_TPS_THRESHOLD_HIGH ) + ',' +
@@ -169,14 +165,14 @@ public Map<String, Object> optimizedPerformanceGraphJSON(ServerUUID serverUUID)
169165 .put ("keys" , new String []{"date" , "playersOnline" , "tps" , "cpu" , "ram" , "entities" , "chunks" , "disk" })
170166 .put ("values" , values )
171167 .put ("colors" , Maps .builder (String .class , Object .class )
172- .put ("playersOnline" , theme . getValue ( ThemeVal .GRAPH_PLAYERS_ONLINE ))
173- .put ("cpu" , theme . getValue ( ThemeVal .GRAPH_CPU ))
174- .put ("ram" , theme . getValue ( ThemeVal .GRAPH_RAM ))
175- .put ("entities" , theme . getValue ( ThemeVal .GRAPH_ENTITIES ))
176- .put ("chunks" , theme . getValue ( ThemeVal .GRAPH_CHUNKS ))
177- .put ("low" , theme . getValue ( ThemeVal .GRAPH_TPS_LOW ))
178- .put ("med" , theme . getValue ( ThemeVal .GRAPH_TPS_MED ))
179- .put ("high" , theme . getValue ( ThemeVal .GRAPH_TPS_HIGH ))
168+ .put ("playersOnline" , ThemeVal .GRAPH_PLAYERS_ONLINE . getDefaultValue ( ))
169+ .put ("cpu" , ThemeVal .GRAPH_CPU . getDefaultValue ( ))
170+ .put ("ram" , ThemeVal .GRAPH_RAM . getDefaultValue ( ))
171+ .put ("entities" , ThemeVal .GRAPH_ENTITIES . getDefaultValue ( ))
172+ .put ("chunks" , ThemeVal .GRAPH_CHUNKS . getDefaultValue ( ))
173+ .put ("low" , ThemeVal .GRAPH_TPS_LOW . getDefaultValue ( ))
174+ .put ("med" , ThemeVal .GRAPH_TPS_MED . getDefaultValue ( ))
175+ .put ("high" , ThemeVal .GRAPH_TPS_HIGH . getDefaultValue ( ))
180176 .build ())
181177 .put ("zones" , Maps .builder (String .class , Object .class )
182178 .put ("tpsThresholdMed" , config .get (DisplaySettings .GRAPH_TPS_THRESHOLD_MED ))
@@ -199,7 +195,7 @@ public String playersOnlineGraph(ServerUUID serverUUID) {
199195 Point ::fromDateObj
200196 );
201197 return "{\" playersOnline\" :" + graphs .line ().lineGraph (points ).toHighChartsSeries () +
202- ",\" color\" :\" " + theme . getValue ( ThemeVal .GRAPH_PLAYERS_ONLINE ) + "\" }" ;
198+ ",\" color\" :\" " + ThemeVal .GRAPH_PLAYERS_ONLINE . getDefaultValue ( ) + "\" }" ;
203199 }
204200
205201 public String uniqueAndNewGraphJSON (ServerUUID serverUUID ) {
@@ -245,8 +241,8 @@ public String createUniqueAndNewJSON(LineGraphFactory lineGraphs, NavigableMap<L
245241 MutatorFunctions .addMissing (newPerDay , gapFillPeriod , 0 )
246242 ), gapStrategy ).toHighChartsSeries () +
247243 ",\" colors\" :{" +
248- "\" playersOnline\" :\" " + theme . getValue ( ThemeVal .GRAPH_PLAYERS_ONLINE ) + "\" ," +
249- "\" newPlayers\" :\" " + theme . getValue ( ThemeVal .LIGHT_GREEN ) + "\" " +
244+ "\" playersOnline\" :\" " + ThemeVal .GRAPH_PLAYERS_ONLINE . getDefaultValue ( ) + "\" ," +
245+ "\" newPlayers\" :\" " + ThemeVal .LIGHT_GREEN . getDefaultValue ( ) + "\" " +
250246 "}}" ;
251247 }
252248
@@ -401,9 +397,9 @@ public Map<String, Object> createGeolocationJSON(Map<String, Integer> geolocatio
401397 .put ("geolocation_series" , worldMap .getEntries ())
402398 .put ("geolocation_bar_series" , geolocationBarGraph .getBars ())
403399 .put ("colors" , Maps .builder (String .class , String .class )
404- .put ("low" , theme . getValue ( ThemeVal .WORLD_MAP_LOW ))
405- .put ("high" , theme . getValue ( ThemeVal .WORLD_MAP_HIGH ))
406- .put ("bars" , theme . getValue ( ThemeVal .GREEN ))
400+ .put ("low" , ThemeVal .WORLD_MAP_LOW . getDefaultValue ( ))
401+ .put ("high" , ThemeVal .WORLD_MAP_HIGH . getDefaultValue ( ))
402+ .put ("bars" , ThemeVal .GREEN . getDefaultValue ( ))
407403 .build ())
408404 .build ();
409405 }
@@ -426,9 +422,9 @@ public String pingGraphsJSON(ServerUUID serverUUID) {
426422 ",\" avg_ping_series\" :" + pingGraph .getAvgGraph ().toHighChartsSeries () +
427423 ",\" max_ping_series\" :" + pingGraph .getMaxGraph ().toHighChartsSeries () +
428424 ",\" colors\" :{" +
429- "\" min\" :\" " + theme . getValue ( ThemeVal .GRAPH_MIN_PING ) + "\" ," +
430- "\" avg\" :\" " + theme . getValue ( ThemeVal .GRAPH_AVG_PING ) + "\" ," +
431- "\" max\" :\" " + theme . getValue ( ThemeVal .GRAPH_MAX_PING ) + "\" " +
425+ "\" min\" :\" " + ThemeVal .GRAPH_MIN_PING . getDefaultValue ( ) + "\" ," +
426+ "\" avg\" :\" " + ThemeVal .GRAPH_AVG_PING . getDefaultValue ( ) + "\" ," +
427+ "\" max\" :\" " + ThemeVal .GRAPH_MAX_PING . getDefaultValue ( ) + "\" " +
432428 "}}" ;
433429 }
434430
@@ -440,7 +436,7 @@ public Map<String, Object> punchCardJSONAsMap(ServerUUID serverUUID) {
440436 );
441437 return Maps .builder (String .class , Object .class )
442438 .put ("punchCard" , graphs .special ().punchCard (sessions ).getDots ())
443- .put ("color" , theme . getValue ( ThemeVal .GRAPH_PUNCHCARD ))
439+ .put ("color" , ThemeVal .GRAPH_PUNCHCARD . getDefaultValue ( ))
444440 .build ();
445441 }
446442
@@ -547,6 +543,6 @@ public GraphCollection<ServerSpecificLineGraph> proxyPlayersOnlineGraphs() {
547543 proxyGraphs .add (new ServerSpecificLineGraph (points , ServerDto .fromServer (proxy )));
548544 }
549545
550- return new GraphCollection <>(proxyGraphs , theme . getValue ( ThemeVal .GRAPH_PLAYERS_ONLINE ));
546+ return new GraphCollection <>(proxyGraphs , ThemeVal .GRAPH_PLAYERS_ONLINE . getDefaultValue ( ));
551547 }
552548}
0 commit comments