Add additional plugin, server and java version stats

This commit is contained in:
Phoenix616 2021-06-04 00:35:27 +01:00
parent 2545b95d54
commit 052560393c
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 16 additions and 0 deletions

View File

@ -436,6 +436,17 @@ public class ChestShop extends JavaPlugin {
bStats.addCustomChart(new Metrics.SimplePie("distributionType", () -> dist));
} catch (IOException ignored) {}
String serverVersion = getServer().getBukkitVersion().split("-")[0];
bStats.addCustomChart(createStaticDrilldownStat("versionMcSelf", serverVersion, getDescription().getVersion()));
bStats.addCustomChart(createStaticDrilldownStat("versionSelfMc", getDescription().getVersion(), serverVersion));
String javaVersion = System.getProperty("java.version");
bStats.addCustomChart(createStaticDrilldownStat("versionJavaSelf", javaVersion, getDescription().getVersion()));
bStats.addCustomChart(createStaticDrilldownStat("versionSelfJava", getDescription().getVersion(), javaVersion));
bStats.addCustomChart(createStaticDrilldownStat("versionJavaMc", javaVersion, serverVersion));
bStats.addCustomChart(createStaticDrilldownStat("versionMcJava", serverVersion, javaVersion));
bStats.addCustomChart(new Metrics.SingleLineChart("shopAccounts", NameManager::getAccountCount));
bStats.addCustomChart(new Metrics.MultiLineChart("transactionCount", () -> ImmutableMap.of(
"total", MetricsModule.getTotalTransactions(),
@ -473,6 +484,11 @@ public class ChestShop extends JavaPlugin {
() -> Properties.SHOP_CONTAINERS.stream().map(Material::name).collect(Collectors.toMap(k -> k, k -> 1))));
}
private Metrics.DrilldownPie createStaticDrilldownStat(String statId, String value1, String value2) {
final Map<String, Map<String, Integer>> map = ImmutableMap.of(value1, ImmutableMap.of(value2, 1));
return new Metrics.DrilldownPie(statId, () -> map);
}
private int[] getChartArray(boolean value) {
return new int[]{!value ? 1 : 0, value ? 0 : 1};
}