From 052560393c246ac36373e68b962c8ac7955e2728 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Fri, 4 Jun 2021 00:35:27 +0100 Subject: [PATCH] Add additional plugin, server and java version stats --- .../java/com/Acrobot/ChestShop/ChestShop.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/Acrobot/ChestShop/ChestShop.java b/src/main/java/com/Acrobot/ChestShop/ChestShop.java index 128ae42..377b087 100644 --- a/src/main/java/com/Acrobot/ChestShop/ChestShop.java +++ b/src/main/java/com/Acrobot/ChestShop/ChestShop.java @@ -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> 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}; }