mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix metrics reporting unknown paper version (#8683)
Co-authored-by: BillyGalbreath <Blake.Galbreath@GMail.com>
This commit is contained in:
parent
deea75d745
commit
deb2116724
1 changed files with 9 additions and 1 deletions
|
@ -619,7 +619,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline"));
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"));
|
||||
+ final String paperVersion;
|
||||
+ final String implVersion = org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion();
|
||||
+ if (implVersion != null) {
|
||||
+ final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
||||
+ paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
||||
+ } else {
|
||||
+ paperVersion = "unknown";
|
||||
+ }
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
|
||||
+
|
||||
+ metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
+ Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
|
|
Loading…
Reference in a new issue