Begin remigrate to Shiroha

uhm
This commit is contained in:
2026-07-14 11:32:51 +08:00
parent 5661499e95
commit 576a9a44c8
60 changed files with 379 additions and 379 deletions
@@ -19,27 +19,27 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
- private static final TextColor SECONDARY = TextColor.color(104, 177, 240);
- private static final TextColor INFORMATION = TextColor.color(145, 198, 243);
- private static final TextColor LIST = TextColor.color(33, 97, 188);
+ private static final TextColor HEADER = TextColor.color(0xcb, 0xa6, 0xf7); // Camellia - Catppuccin Mocha: Mauve
+ private static final TextColor PRIMARY = TextColor.color(0xa6, 0xad, 0xc8); // Camellia - Catppuccin Mocha: Subtext0
+ private static final TextColor SECONDARY = TextColor.color(0xb4, 0xbe, 0xfe); // Camellia - Catppuccin Mocha: Lavender
+ private static final TextColor INFORMATION = TextColor.color(0xcd, 0xd6, 0xf4); // Camellia - Catppuccin Mocha: Text
+ private static final TextColor LIST = TextColor.color(0x74, 0xc7, 0xec); // Camellia - Catppuccin Mocha: Sapphire
+ // Camellia start - prettier /tps output
+ private static final TextColor HEADER = TextColor.color(0xcb, 0xa6, 0xf7); // Shiroha - Catppuccin Mocha: Mauve
+ private static final TextColor PRIMARY = TextColor.color(0xa6, 0xad, 0xc8); // Shiroha - Catppuccin Mocha: Subtext0
+ private static final TextColor SECONDARY = TextColor.color(0xb4, 0xbe, 0xfe); // Shiroha - Catppuccin Mocha: Lavender
+ private static final TextColor INFORMATION = TextColor.color(0xcd, 0xd6, 0xf4); // Shiroha - Catppuccin Mocha: Text
+ private static final TextColor LIST = TextColor.color(0x74, 0xc7, 0xec); // Shiroha - Catppuccin Mocha: Sapphire
+ // Shiroha start - prettier /tps output
+ private static final TextColor MUTED = TextColor.color(0x6c, 0x70, 0x86); // Catppuccin Mocha: Overlay0
+ private static final int DIVIDER_WIDTH = 44;
+ private static final int BAR_SEGMENTS = 20;
+ private static final String[] RANK_ICONS = {"①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩"};
+ // Camellia end
+ // Shiroha end
public CommandServerHealth() {
super("tps");
- this.setUsage("/<command> [server/region] [lowest regions to display]");
+ this.setUsage("/<command> [server/region] [lowest regions to display|all]"); // Camellia - document "all" option
+ this.setUsage("/<command> [server/region] [lowest regions to display|all]"); // Shiroha - document "all" option
this.setDescription("Reports information about server health.");
this.setPermission("bukkit.command.tps");
}
+ // Camellia start - prettier /tps output helpers
+ // Shiroha start - prettier /tps output helpers
+ private static Component divider() {
+ // strikethrough spaces render as a solid flat line on every client/font, unlike box-drawing glyphs
+ return Component.text(" ".repeat(DIVIDER_WIDTH), MUTED, TextDecoration.STRIKETHROUGH);
@@ -67,11 +67,11 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
+ .append(Component.text(" ".repeat(BAR_SEGMENTS - filled), MUTED, TextDecoration.STRIKETHROUGH))
+ .build();
+ }
+ // Camellia end
+ // Shiroha end
+
private static Component formatRegionInfo(final String prefix, final double util, final double mspt, final double tps,
final boolean newline) {
+ // Camellia start - use progress bar + dot separators instead of plain "util at ... MSPT at ..." text
+ // Shiroha start - use progress bar + dot separators instead of plain "util at ... MSPT at ..." text
return Component.text()
- .append(Component.text(prefix, PRIMARY, TextDecoration.BOLD))
- .append(Component.text(ONE_DECIMAL_PLACES.get().format(util * 100.0), CommandUtil.getUtilisationColourRegion(util)))
@@ -91,11 +91,11 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
+ .append(Component.text(TWO_DECIMAL_PLACES.get().format(tps) + " tps", CommandUtil.getColourForTPS(tps)))
+ .append(Component.text(newline ? "\n" : "", PRIMARY))
+ .build();
+ // Camellia end
+ // Shiroha end
}
private static Component formatRegionStats(final TickRegions.RegionStats stats, final boolean newline) {
+ // Camellia start - add "·" separators for readability
+ // Shiroha start - add "·" separators for readability
return Component.text()
- .append(Component.text("Chunks: ", PRIMARY))
- .append(Component.text(NO_DECIMAL_PLACES.get().format((long)stats.getChunkCount()), INFORMATION))
@@ -111,7 +111,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
+ .append(Component.text(" · Entities: ", PRIMARY))
+ .append(Component.text(NO_DECIMAL_PLACES.get().format((long)stats.getEntityCount()) + (newline ? "\n" : ""), INFORMATION))
+ .build();
+ // Camellia end
+ // Shiroha end
}
private static boolean executeRegion(final CommandSender sender, final String commandLabel, final String[] args) {
@@ -125,7 +125,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
final int yLoc = 80;
final String location = "[w:'" + world.getWorld().getName() + "'," + centerBlockX + "," + yLoc + "," + centerBlockZ + "]";
+ // Camellia start - prettier /tps region output
+ // Shiroha start - prettier /tps region output
final Component line = Component.text()
- .append(Component.text("Region around block ", PRIMARY))
- .append(Component.text(location, INFORMATION))
@@ -157,7 +157,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
+ )
+
+ .build();
+ // Camellia end
+ // Shiroha end
sender.sendMessage(line);
@@ -165,7 +165,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
}
private static boolean executeServer(final CommandSender sender, final String commandLabel, final String[] args) {
+ // Camellia start - "all" lists every tick region instead of just the top N by utilisation
+ // Shiroha start - "all" lists every tick region instead of just the top N by utilisation
+ final boolean showAllRegions = args.length >= 2 && args[1].equalsIgnoreCase("all");
final int lowestRegionsCount;
- if (args.length < 2) {
@@ -181,7 +181,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
return true;
}
}
+ // Camellia end
+ // Shiroha end
final List<ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData>> regions =
- new ArrayList<>();
@@ -193,7 +193,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
final double loadRate = ca.spottedleaf.moonrise.patches.chunk_system.scheduling.task.ChunkFullTask.loadRate(currTime);
totalUtil += globalTickReport.utilisation();
+ final double overallFraction = maxThreadCount > 0 ? (totalUtil / maxThreadCount) : 0.0; // Camellia - overall load fraction for progress bar
+ final double overallFraction = maxThreadCount > 0 ? (totalUtil / maxThreadCount) : 0.0; // Shiroha - overall load fraction for progress bar
tpsByRegion.sort(null);
if (!tpsByRegion.isEmpty()) {
@@ -211,10 +211,10 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
if (sender instanceof Player) {
- lowestRegionsBuilder.append(Component.text(" Click to teleport\n", SECONDARY));
+ lowestRegionsBuilder.append(Component.text(" Click to teleport\n", SECONDARY, TextDecoration.ITALIC)); // Camellia - restyle hint text
+ lowestRegionsBuilder.append(Component.text(" Click to teleport\n", SECONDARY, TextDecoration.ITALIC)); // Shiroha - restyle hint text
}
- for (int i = 0, len = Math.min(lowestRegionsCount, regionsBelowThreshold.size()); i < len; ++i) {
+ for (int i = 0, len = showAllRegions ? regionsBelowThreshold.size() : Math.min(lowestRegionsCount, regionsBelowThreshold.size()); i < len; ++i) { // Camellia - support "all"
+ for (int i = 0, len = showAllRegions ? regionsBelowThreshold.size() : Math.min(lowestRegionsCount, regionsBelowThreshold.size()); i < len; ++i) { // Shiroha - support "all"
final ObjectObjectImmutablePair<ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData>, TickData.TickReportData>
- pair = regionsBelowThreshold.get(i);
+ pair = regionsBelowThreshold.get(i);
@@ -230,7 +230,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
final int yLoc = 80;
final String location = "[w:'" + world.getWorld().getName() + "'," + centerBlockX + "," + yLoc + "," + centerBlockZ + "]";
+ // Camellia start - prettier /tps region list entries
+ // Shiroha start - prettier /tps region list entries
final Component line = Component.text()
- .append(Component.text(" - ", LIST, TextDecoration.BOLD))
- .append(Component.text("Region around block ", PRIMARY))
@@ -251,7 +251,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
-
- .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, Payload.string("/minecraft:execute as @s in " + world.getWorld().getKey().toString() + " run tp " + centerBlockX + ".5 " + yLoc + " " + centerBlockZ + ".5")))
- .hoverEvent(HoverEvent.hoverEvent(HoverEvent.Action.SHOW_TEXT, Component.text("Click to teleport to " + location, SECONDARY)));
+ .append(Component.text(" " + rankLabel(i) + " ", LIST, TextDecoration.BOLD)) // Camellia - Catppuccin Mocha: Sapphire rank marker
+ .append(Component.text(" " + rankLabel(i) + " ", LIST, TextDecoration.BOLD)) // Shiroha - Catppuccin Mocha: Sapphire rank marker
+ .append(Component.text(location + "\n", INFORMATION))
+
+ .append(Component.text(" "))
@@ -269,7 +269,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
+
+ .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, Payload.string("/minecraft:execute as @s in " + world.getWorld().getKey().toString() + " run tp " + centerBlockX + ".5 " + yLoc + " " + centerBlockZ + ".5")))
+ .hoverEvent(HoverEvent.hoverEvent(HoverEvent.Action.SHOW_TEXT, Component.text("Click to teleport to " + location, SECONDARY)));
+ // Camellia end
+ // Shiroha end
lowestRegionsBuilder.append(line);
}
@@ -318,7 +318,7 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
-
- .append(lowestRegionsBuilder.build())
- .build()
+ // Camellia start - prettier /tps server output
+ // Shiroha start - prettier /tps server output
+ Component.text()
+ .append(sectionHeader("Server Health Report"))
+ .append(divider())
@@ -357,11 +357,11 @@ index aa860cfe9de616f185163fe74e0f4f49bd13a805..3545258acc0f516045594674c6f39f74
+
+ .append(divider())
+ .append(Component.text("\n"))
+ .append(sectionHeader(showAllRegions ? "All " + regions.size() + " regions by utilisation" : "Top " + lowestRegionsCount + " regions by utilisation")) // Camellia - "all" heading
+ .append(sectionHeader(showAllRegions ? "All " + regions.size() + " regions by utilisation" : "Top " + lowestRegionsCount + " regions by utilisation")) // Shiroha - "all" heading
+
+ .append(lowestRegionsBuilder.build())
+ .build()
+ // Camellia end
+ // Shiroha end
);
return true;