mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-10 02:17:41 +01:00
[Debt] Removed static Theme getValue method
Theme depends on a configuration file, so it should not be static. Affected issues: none
This commit is contained in:
parent
275bfe64b4
commit
35be0a2afb
@ -40,6 +40,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
private PlanConfig config;
|
private PlanConfig config;
|
||||||
|
private Theme theme;
|
||||||
private Database database;
|
private Database database;
|
||||||
private Graphs graphs;
|
private Graphs graphs;
|
||||||
|
|
||||||
@ -97,9 +98,9 @@ public class NetworkContainer extends DataContainer {
|
|||||||
bungeeContainer.getValue(ServerKeys.NAME).orElse("Plan")
|
bungeeContainer.getValue(ServerKeys.NAME).orElse("Plan")
|
||||||
);
|
);
|
||||||
putSupplier(NetworkKeys.PLAYERS_ONLINE, ServerInfo.getServerProperties_Old()::getOnlinePlayers);
|
putSupplier(NetworkKeys.PLAYERS_ONLINE, ServerInfo.getServerProperties_Old()::getOnlinePlayers);
|
||||||
putRawData(NetworkKeys.WORLD_MAP_LOW_COLOR, Theme.getValue_Old(ThemeVal.WORLD_MAP_LOW));
|
putRawData(NetworkKeys.WORLD_MAP_LOW_COLOR, theme.getValue(ThemeVal.WORLD_MAP_LOW));
|
||||||
putRawData(NetworkKeys.WORLD_MAP_HIGH_COLOR, Theme.getValue_Old(ThemeVal.WORLD_MAP_HIGH));
|
putRawData(NetworkKeys.WORLD_MAP_HIGH_COLOR, theme.getValue(ThemeVal.WORLD_MAP_HIGH));
|
||||||
putRawData(NetworkKeys.PLAYERS_GRAPH_COLOR, Theme.getValue_Old(ThemeVal.GRAPH_PLAYERS_ONLINE));
|
putRawData(NetworkKeys.PLAYERS_GRAPH_COLOR, theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPlayerInformation() {
|
private void addPlayerInformation() {
|
||||||
|
@ -42,15 +42,6 @@ public class Theme implements SubSystem {
|
|||||||
return themeSystem;
|
return themeSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static String getValue_Old(ThemeVal variable) {
|
|
||||||
try {
|
|
||||||
return getInstance().getThemeValue(variable);
|
|
||||||
} catch (NullPointerException | IllegalStateException e) {
|
|
||||||
return variable.getDefaultValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue(ThemeVal variable) {
|
public String getValue(ThemeVal variable) {
|
||||||
try {
|
try {
|
||||||
return getThemeValue(variable);
|
return getThemeValue(variable);
|
||||||
@ -78,7 +69,7 @@ public class Theme implements SubSystem {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColor(ThemeVal variable) {
|
private String getColor(ThemeVal variable) {
|
||||||
String path = variable.getThemePath();
|
String path = variable.getThemePath();
|
||||||
try {
|
try {
|
||||||
String value = config.getString(path);
|
String value = config.getString(path);
|
||||||
|
@ -73,7 +73,7 @@ public class PlayerCalendar {
|
|||||||
|
|
||||||
series.append(",{title: 'Playtime: ").append(timeAmountFormatter.apply(playtime))
|
series.append(",{title: 'Playtime: ").append(timeAmountFormatter.apply(playtime))
|
||||||
.append("',start:'").append(day)
|
.append("',start:'").append(day)
|
||||||
.append("',color: '").append(Theme.getValue_Old(ThemeVal.GREEN)).append("'")
|
.append("',color: '").append(theme.getValue(ThemeVal.GREEN)).append("'")
|
||||||
.append("}");
|
.append("}");
|
||||||
|
|
||||||
series.append(",{title: 'Sessions: ").append(sessionCount)
|
series.append(",{title: 'Sessions: ").append(sessionCount)
|
||||||
|
@ -47,6 +47,7 @@ public class InspectPage implements Page {
|
|||||||
private final Map<UUID, String> serverNames;
|
private final Map<UUID, String> serverNames;
|
||||||
|
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
|
private final Theme theme;
|
||||||
private final Graphs graphs;
|
private final Graphs graphs;
|
||||||
private final HtmlTables tables;
|
private final HtmlTables tables;
|
||||||
private final ServerInfo serverInfo;
|
private final ServerInfo serverInfo;
|
||||||
@ -60,6 +61,7 @@ public class InspectPage implements Page {
|
|||||||
InspectPage(
|
InspectPage(
|
||||||
PlayerContainer player, Map<UUID, String> serverNames,
|
PlayerContainer player, Map<UUID, String> serverNames,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
|
Theme theme,
|
||||||
Graphs graphs,
|
Graphs graphs,
|
||||||
HtmlTables tables,
|
HtmlTables tables,
|
||||||
Formatters formatters,
|
Formatters formatters,
|
||||||
@ -69,6 +71,7 @@ public class InspectPage implements Page {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
this.serverNames = serverNames;
|
this.serverNames = serverNames;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
this.theme = theme;
|
||||||
this.graphs = graphs;
|
this.graphs = graphs;
|
||||||
this.tables = tables;
|
this.tables = tables;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
@ -131,9 +134,9 @@ public class InspectPage implements Page {
|
|||||||
|
|
||||||
Map<UUID, WorldTimes> worldTimesPerServer = perServerMutator.worldTimesPerServer();
|
Map<UUID, WorldTimes> worldTimesPerServer = perServerMutator.worldTimesPerServer();
|
||||||
replacer.put("serverPieSeries", graphs.pie().serverPreferencePie(serverNames, worldTimesPerServer).toHighChartsSeries());
|
replacer.put("serverPieSeries", graphs.pie().serverPreferencePie(serverNames, worldTimesPerServer).toHighChartsSeries());
|
||||||
replacer.put("worldPieColors", Theme.getValue_Old(ThemeVal.GRAPH_WORLD_PIE));
|
replacer.put("worldPieColors", theme.getValue(ThemeVal.GRAPH_WORLD_PIE));
|
||||||
replacer.put("gmPieColors", Theme.getValue_Old(ThemeVal.GRAPH_GM_PIE));
|
replacer.put("gmPieColors", theme.getValue(ThemeVal.GRAPH_GM_PIE));
|
||||||
replacer.put("serverPieColors", Theme.getValue_Old(ThemeVal.GRAPH_SERVER_PREF_PIE));
|
replacer.put("serverPieColors", theme.getValue(ThemeVal.GRAPH_SERVER_PREF_PIE));
|
||||||
|
|
||||||
String favoriteServer = serverNames.getOrDefault(perServerMutator.favoriteServer(), "Unknown");
|
String favoriteServer = serverNames.getOrDefault(perServerMutator.favoriteServer(), "Unknown");
|
||||||
replacer.put("favoriteServer", favoriteServer);
|
replacer.put("favoriteServer", favoriteServer);
|
||||||
|
@ -90,7 +90,7 @@ public class PageFactory {
|
|||||||
Map<UUID, String> serverNames = database.get().fetch().getServerNames();
|
Map<UUID, String> serverNames = database.get().fetch().getServerNames();
|
||||||
return new InspectPage(
|
return new InspectPage(
|
||||||
player, serverNames,
|
player, serverNames,
|
||||||
config.get(), graphs.get(), tables.get(), formatters.get(), serverInfo.get(), timings.get()
|
config.get(), theme, graphs.get(), tables.get(), formatters.get(), serverInfo.get(), timings.get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user