diff --git a/patches/server/0005-Rebrand.patch b/patches/server/0005-Rebrand.patch index 9c524be..b97e582 100644 --- a/patches/server/0005-Rebrand.patch +++ b/patches/server/0005-Rebrand.patch @@ -49,7 +49,7 @@ index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..7d80d2cf5d607d6051e99e4b08bc1b76 metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { Map> map = new HashMap<>(); diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index 462a6eed350fd660ddaf25d567bb6e97b77d0b2b..fec95437c1ad602f64c4d4d02c276199f27babbd 100644 +index 462a6eed350fd660ddaf25d567bb6e97b77d0b2b..7167c08053071f71c45162d455efed86ffcd2c6e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java @@ -20,7 +20,7 @@ import java.util.stream.StreamSupport; @@ -68,7 +68,7 @@ index 462a6eed350fd660ddaf25d567bb6e97b77d0b2b..fec95437c1ad602f64c4d4d02c276199 - String[] parts = serverVersion.substring("git-Purpur-".length()).split("[-\\s]"); // Purpur - final Component updateMessage = getUpdateStatusMessage("PurpurMC/Purpur", "ver/" + getMinecraftVersion(), parts[0]); // Purpur + String[] parts = serverVersion.substring("git-Plazma-".length()).split("[-\\s]"); // Purpur // Plazma -+ final Component updateMessage = getUpdateStatusMessage("PlazmaMC/Plazma", "ver/" + getMinecraftVersion(), parts[0]); // Purpur // Plazma ++ final Component updateMessage = getUpdateStatusMessage("PlazmaMC/PlazmaBukkit", "ver/" + getMinecraftVersion(), parts[0]); // Purpur // Plazma final Component history = getHistory(); return history != null ? Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()), history, updateMessage) : updateMessage; // Purpur diff --git a/patches/server/0010-Add-more-metrics.patch b/patches/server/0010-Add-more-metrics.patch index c278c40..84630eb 100644 --- a/patches/server/0010-Add-more-metrics.patch +++ b/patches/server/0010-Add-more-metrics.patch @@ -5,14 +5,16 @@ Subject: [PATCH] Add more metrics diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java -index 7d80d2cf5d607d6051e99e4b08bc1b76098a79da..f006c867ad0765e0f52a629729ab131acec5c2fc 100644 +index 7d80d2cf5d607d6051e99e4b08bc1b76098a79da..057fb0be810930b1d1a18d7d572c18ac066ac849 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java -@@ -636,16 +636,52 @@ public class Metrics { +@@ -636,38 +636,59 @@ public class Metrics { return map; })); -+ // Plazma start +- metrics.addCustomChart(new Metrics.DrilldownPie("legacy_plugins", () -> { +- Map> map = new HashMap<>(); ++ // Plazma start - Add more metrics information + metrics.addCustomChart(new DrilldownPie("datapacks", () -> { + int datapacks = Bukkit.getDatapackManager().getEnabledPacks().size(); + Map entry = Collections.singletonMap(String.valueOf(datapacks), 1); @@ -22,13 +24,19 @@ index 7d80d2cf5d607d6051e99e4b08bc1b76098a79da..f006c867ad0765e0f52a629729ab131a + else if (datapacks <= 10) return Collections.singletonMap("6-10", entry); + else if (datapacks <= 25) return Collections.singletonMap("11-25", entry); + else if (datapacks <= 50) return Collections.singletonMap("26-50", entry); -+ else return Collections.singletonMap("50+", entry); ++ else if (datapacks <= 100) return Collections.singletonMap("51+", entry); ++ else return Collections.singletonMap("101+ \uD83D\uDE2E", entry); + })); -+ -+ List plugins = Arrays.stream(Bukkit.getPluginManager().getPlugins()).toList(); -+ + +- // count legacy plugins +- int legacy = 0; +- for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { +- if (CraftMagicNumbers.isLegacy(plugin.getDescription())) { +- legacy++; +- } +- } + metrics.addCustomChart(new DrilldownPie("plugins", () -> { -+ int pluginCount = (int) plugins.stream().filter(Plugin::isEnabled).count(); ++ int pluginCount = Arrays.stream(Bukkit.getPluginManager().getPlugins()).filter(Plugin::isEnabled).toList().size(); + Map entry = Collections.singletonMap(String.valueOf(pluginCount), 1); + + if (pluginCount == 0) return Collections.singletonMap("0", entry); @@ -36,11 +44,30 @@ index 7d80d2cf5d607d6051e99e4b08bc1b76098a79da..f006c867ad0765e0f52a629729ab131a + else if (pluginCount <= 10) return Collections.singletonMap("6-10", entry); + else if (pluginCount <= 25) return Collections.singletonMap("11-25", entry); + else if (pluginCount <= 50) return Collections.singletonMap("26-50", entry); -+ else return Collections.singletonMap("50+", entry); ++ else if (pluginCount <= 100) return Collections.singletonMap("51-100", entry); ++ else return Collections.singletonMap("101+ \uD83D\uDE2E", entry); + })); -+ + +- // insert real value as lower dimension +- Map 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: +- } + metrics.addCustomChart(new DrilldownPie("disabled_plugins", () -> { -+ int disabled = (int) plugins.stream().filter(java.util.function.Predicate.not(Plugin::isEnabled)).count(); ++ int disabled = Arrays.stream(Bukkit.getPluginManager().getPlugins()).filter(it -> !it.isEnabled()).toList().size(); + Map entry = Collections.singletonMap(String.valueOf(disabled), 1); + + if (disabled == 0) return Collections.singletonMap("0 \uD83D\uDE0E", entry); // :sunglasses: @@ -48,22 +75,24 @@ index 7d80d2cf5d607d6051e99e4b08bc1b76098a79da..f006c867ad0765e0f52a629729ab131a + else if (disabled <= 10) return Collections.singletonMap("6-10", entry); + else if (disabled <= 25) return Collections.singletonMap("11-25", entry); + else if (disabled <= 50) return Collections.singletonMap("26-50", entry); -+ else if (disabled <= 100) return Collections.singletonMap("50-100 \uD83D\uDE2D", entry); // :cry: ++ else if (disabled <= 100) return Collections.singletonMap("51-100 \uD83D\uDE2D", entry); // :cry: + else return Collections.singletonMap("101+ \uD83D\uDC80", entry); // :skull: + })); -+ // Plazma end + +- return map; ++ metrics.addCustomChart(new Metrics.DrilldownPie("legacy_plugins", () -> { ++ int legacy = (int) Arrays.stream(Bukkit.getPluginManager().getPlugins()).filter(p -> CraftMagicNumbers.isLegacy(p.getDescription())).count(); // Plazma ++ Map entry = Collections.singletonMap(String.valueOf(legacy), 1); + - metrics.addCustomChart(new Metrics.DrilldownPie("legacy_plugins", () -> { - Map> map = new HashMap<>(); ++ if (legacy == 0) return Collections.singletonMap("0 \uD83D\uDE0E", entry); // :sunglasses: ++ else if (legacy <= 5) return Collections.singletonMap("1-5", entry); ++ else if (legacy <= 10) return Collections.singletonMap("6-10", entry); ++ else if (legacy <= 25) return Collections.singletonMap("11-25", entry); ++ else if (legacy <= 50) return Collections.singletonMap("26-50", entry); ++ else if (legacy <= 100) return Collections.singletonMap("51-100 \uD83D\uDE2D", entry); // :cry: ++ else return Collections.singletonMap("101+ \uD83D\uDC80", entry); // :skull: + })); ++ // Plazma end - Add more metrics information + } - // count legacy plugins -- int legacy = 0; -- for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { -- if (CraftMagicNumbers.isLegacy(plugin.getDescription())) { -- legacy++; -- } -- } -+ int legacy = (int) plugins.stream().filter(p -> CraftMagicNumbers.isLegacy(p.getDescription())).count(); // Plazma - - // insert real value as lower dimension - Map entry = new HashMap<>(); + }