Skip to content

Commit

Permalink
Update bstats
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jul 22, 2023
1 parent 6a67554 commit 03d60bc
Showing 1 changed file with 55 additions and 3 deletions.
58 changes: 55 additions & 3 deletions patches/server/0001-Build-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ index 57f2c414dbfe127c193002fbc8eeb22e94e9cb55..9d013901f963ff06cddbacd431921b78
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 4b002e8b75d117b726b0de274a76d3596fce015b..0ac8bcb0a4b7d1da3d0e016617db7a81ce9acead 100644
index 4b002e8b75d117b726b0de274a76d3596fce015b..a2e9688135f75a58d2eb3dd26222f67289d243e0 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
Expand All @@ -77,7 +77,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..0ac8bcb0a4b7d1da3d0e016617db7a81

metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -603,15 +603,7 @@ public class Metrics {
@@ -603,15 +603,16 @@ public class Metrics {

metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline"));
Expand All @@ -90,10 +90,62 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..0ac8bcb0a4b7d1da3d0e016617db7a81
- paperVersion = "unknown";
- }
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
+ metrics.addCustomChart(new Metrics.SimplePie("leaves_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Leaves - we have our own bstats page
+ // Leaves start - we have our own bstats page
+ metrics.addCustomChart(new Metrics.SimplePie("leaves_version", () -> {
+ String serverVersion = Bukkit.getVersion();
+ if (!serverVersion.startsWith("null")) {
+ String gitHash = serverVersion.substring("git-Leaves-".length()).split("[-\\s]")[0].replaceAll("\"", "");
+ return "git-Leaves-" + Bukkit.getMinecraftVersion() + "-" + gitHash;
+ }
+ return "unknown";
+ }));
+ // Leaves end - we have our own bstats page

metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
@@ -643,41 +644,8 @@ public class Metrics {

return map;
}));
-
- metrics.addCustomChart(new Metrics.DrilldownPie("legacy_plugins", () -> {
- Map<String, Map<String, Integer>> map = new HashMap<>();
-
- // count legacy plugins
- int legacy = 0;
- for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
- if (CraftMagicNumbers.isLegacy(plugin.getDescription())) {
- legacy++;
- }
- }
-
- // insert real value as lower dimension
- Map<String, Integer> entry = new HashMap<>();
- entry.put(String.valueOf(legacy), 1);
-
- // create buckets as higher dimension
- if (legacy == 0) {
- map.put("0 \uD83D\uDE0E", entry); // :sunglasses:
- } else if (legacy <= 5) {
- map.put("1-5", entry);
- } else if (legacy <= 10) {
- map.put("6-10", entry);
- } else if (legacy <= 25) {
- map.put("11-25", entry);
- } else if (legacy <= 50) {
- map.put("26-50", entry);
- } else {
- map.put("50+ \uD83D\uDE2D", entry); // :cry:
- }
-
- return map;
- }));
+ // Leaves - remove legacy_plugins
}
-
}
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3238cbcba567b1242c77e41f6b6f19a8d157fb4e..670f25370554c3f8c40d2fcc4f5a31d7a372f452 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
Expand Down

0 comments on commit 03d60bc

Please sign in to comment.