mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Added AnalysisContainer access to PluginData on getServerContainer call
This commit is contained in:
parent
02f3aa21de
commit
61cb0ecb0a
@ -28,6 +28,8 @@ public abstract class PluginData {
|
||||
|
||||
private String helpText;
|
||||
|
||||
protected com.djrapitops.plan.data.store.containers.AnalysisContainer analysisData;
|
||||
|
||||
public PluginData(ContainerSize size, String sourcePlugin) {
|
||||
this.size = size;
|
||||
this.sourcePlugin = sourcePlugin;
|
||||
@ -87,4 +89,8 @@ public abstract class PluginData {
|
||||
public final String getWithIcon(String text, String icon, String color) {
|
||||
return Html.FA_COLORED_ICON.parse(color, icon) + " " + text;
|
||||
}
|
||||
|
||||
public final void setAnalysisData(com.djrapitops.plan.data.store.containers.AnalysisContainer analysisData) {
|
||||
this.analysisData = analysisData;
|
||||
}
|
||||
}
|
||||
|
@ -377,7 +377,9 @@ public class AnalysisContainer extends DataContainer {
|
||||
// TODO Refactor into a system that supports running the analysis on Bungee
|
||||
Key<String[]> navAndTabs = new Key<>(new Type<String[]>() {}, "NAV_AND_TABS");
|
||||
putSupplier(navAndTabs, () ->
|
||||
AnalysisPluginsTabContentCreator.createContent(getUnsafe(AnalysisKeys.PLAYERS_MUTATOR))
|
||||
AnalysisPluginsTabContentCreator.createContent(
|
||||
getUnsafe(AnalysisKeys.PLAYERS_MUTATOR),
|
||||
this)
|
||||
);
|
||||
putSupplier(AnalysisKeys.PLUGINS_TAB_NAV, () -> getUnsafe(navAndTabs)[0]);
|
||||
putSupplier(AnalysisKeys.PLUGINS_TAB, () -> getUnsafe(navAndTabs)[1]);
|
||||
|
@ -25,13 +25,16 @@ import java.util.*;
|
||||
*/
|
||||
public class AnalysisPluginsTabContentCreator {
|
||||
|
||||
public static String[] createContent(PlayersMutator mutator) {
|
||||
public static String[] createContent(
|
||||
PlayersMutator mutator,
|
||||
com.djrapitops.plan.data.store.containers.AnalysisContainer analysisContainer
|
||||
) {
|
||||
if (mutator.all().isEmpty()) {
|
||||
return new String[]{"<li><a>No Data</a></li>", ""};
|
||||
}
|
||||
|
||||
List<UUID> uuids = mutator.uuids();
|
||||
Map<PluginData, AnalysisContainer> containers = analyzeAdditionalPluginData(uuids);
|
||||
Map<PluginData, AnalysisContainer> containers = analyzeAdditionalPluginData(uuids, analysisContainer);
|
||||
|
||||
List<PluginData> order = new ArrayList<>(containers.keySet());
|
||||
order.sort(new PluginDataNameComparator());
|
||||
@ -90,7 +93,10 @@ public class AnalysisPluginsTabContentCreator {
|
||||
};
|
||||
}
|
||||
|
||||
private static Map<PluginData, AnalysisContainer> analyzeAdditionalPluginData(Collection<UUID> uuids) {
|
||||
private static Map<PluginData, AnalysisContainer> analyzeAdditionalPluginData(
|
||||
Collection<UUID> uuids,
|
||||
com.djrapitops.plan.data.store.containers.AnalysisContainer analysisContainer
|
||||
) {
|
||||
Map<PluginData, AnalysisContainer> containers = new HashMap<>();
|
||||
|
||||
List<PluginData> sources = HookHandler.getInstance().getAdditionalDataSources();
|
||||
@ -101,6 +107,7 @@ public class AnalysisPluginsTabContentCreator {
|
||||
try {
|
||||
Benchmark.start("Analysis", "Analysis: Source " + source.getSourcePlugin());
|
||||
|
||||
source.setAnalysisData(analysisContainer);
|
||||
AnalysisContainer container = source.getServerData(uuids, new AnalysisContainer());
|
||||
if (container != null && !container.isEmpty()) {
|
||||
containers.put(source, container);
|
||||
|
Loading…
Reference in New Issue
Block a user