From df9f53b1af8a9e2abc800faf177a971c388fa153 Mon Sep 17 00:00:00 2001 From: bensuisse Date: Wed, 5 Aug 2026 22:24:09 +0200 Subject: [PATCH] color fixed --- .../scoreboard/ScoreboardService.java | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/main/java/ch/bensuisse/miningman/features/scoreboard/ScoreboardService.java b/src/main/java/ch/bensuisse/miningman/features/scoreboard/ScoreboardService.java index 5fccaf2..a18d116 100644 --- a/src/main/java/ch/bensuisse/miningman/features/scoreboard/ScoreboardService.java +++ b/src/main/java/ch/bensuisse/miningman/features/scoreboard/ScoreboardService.java @@ -44,7 +44,7 @@ public class ScoreboardService implements Listener { private static final String OBJECTIVE_NAME = "miningman_sb"; private static final TextColor LABEL_COLOR = TextColor.fromHexString("#FE5A1D"); - // Jede Zeile bekommt einen eigenen, satten Farbton für das Icon. + // Jede Zeile bekommt einen eigenen, satten Farbton - Titel und Icon in derselben Farbe. private static final TextColor NAME_COLOR = TextColor.fromHexString("#FF5C8A"); private static final TextColor RANK_COLOR = TextColor.fromHexString("#FFD400"); private static final TextColor DEATHS_COLOR = TextColor.fromHexString("#FF3B3B"); @@ -54,11 +54,6 @@ public class ScoreboardService implements Listener { private static final TextColor MINED_COLOR = TextColor.fromHexString("#C68642"); private static final TextColor WALKED_COLOR = TextColor.fromHexString("#22D3EE"); - // Die Titel (außer Name, der bleibt pink wie das Icon) bleiben im Marken-Rot-Orange, - // nur jede Zeile in einer anderen Stufe (dunkel -> hell). - private static final List LABEL_SHADES = ColorUtil.createGradient( - TextColor.fromHexString("#C43C0A"), TextColor.fromHexString("#FFC28C"), 7); - private static final String SEPARATOR = " "; // 25 Zeichen, als Leerzeichen für eine durchgehende Linie private static final String SERVER_DOMAIN = "ᴍɪɴɪɴɢᴍᴀɴ.eu"; private static final List MINEABLE_MATERIALS = Arrays.stream(Material.values()) @@ -199,18 +194,18 @@ public class ScoreboardService implements Listener { lines.add(separator()); lines.add(nameLine(player)); - lines.add(rankLine(player, LABEL_SHADES.get(0))); + lines.add(rankLine(player)); lines.add(Component.empty()); - lines.add(statLine("☠", DEATHS_COLOR, "ᴅᴇᴀᴛʜs", LABEL_SHADES.get(1), + lines.add(statLine("☠", DEATHS_COLOR, "ᴅᴇᴀᴛʜs", String.valueOf(player.getStatistic(Statistic.DEATHS)))); - lines.add(statLine("⌛", PLAYTIME_COLOR, "ᴘʟᴀʏᴛɪᴍᴇ", LABEL_SHADES.get(2), + lines.add(statLine("⌛", PLAYTIME_COLOR, "ᴘʟᴀʏᴛɪᴍᴇ", formatPlaytime(player.getStatistic(Statistic.PLAY_ONE_MINUTE)))); - lines.add(statLine("◎", ONLINE_COLOR, "ᴏɴʟɪɴᴇ", LABEL_SHADES.get(3), + lines.add(statLine("◎", ONLINE_COLOR, "ᴏɴʟɪɴᴇ", Bukkit.getOnlinePlayers().size() + "/" + Bukkit.getMaxPlayers())); lines.add(Component.empty()); - lines.add(statLine("⧉", PLACED_COLOR, "ᴘʟᴀᴄᴇᴅ", LABEL_SHADES.get(4), formatNumber(blockStats[1]))); - lines.add(statLine("⛏", MINED_COLOR, "ᴍɪɴᴇᴅ", LABEL_SHADES.get(5), formatNumber(blockStats[0]))); - lines.add(statLine("⇄", WALKED_COLOR, "ᴡᴀʟᴋᴇᴅ", LABEL_SHADES.get(6), formatNumber(getBlocksWalked(player)))); + lines.add(statLine("⧉", PLACED_COLOR, "ᴘʟᴀᴄᴇᴅ", formatNumber(blockStats[1]))); + lines.add(statLine("⛏", MINED_COLOR, "ᴍɪɴᴇᴅ", formatNumber(blockStats[0]))); + lines.add(statLine("⇄", WALKED_COLOR, "ᴡᴀʟᴋᴇᴅ", formatNumber(getBlocksWalked(player)))); lines.add(separator()); lines.add(ipLine()); @@ -227,7 +222,7 @@ public class ScoreboardService implements Listener { .append(Component.text(player.getName(), NamedTextColor.WHITE).decoration(TextDecoration.BOLD, false)); } - private Component rankLine(Player player, TextColor labelColor) { + private Component rankLine(Player player) { User user = luckPerms.getUserManager().getUser(player.getUniqueId()); String prefix = user != null ? user.getCachedData().getMetaData().getPrefix() : null; @@ -239,13 +234,13 @@ public class ScoreboardService implements Listener { } return Component.text(" ★ ", RANK_COLOR) - .append(Component.text("ʀᴀɴᴋ: ", labelColor)) + .append(Component.text("ʀᴀɴᴋ: ", RANK_COLOR)) .append(rankValue); } - private Component statLine(String icon, TextColor iconColor, String label, TextColor labelColor, String value) { - return Component.text(" " + icon + " ", iconColor) - .append(Component.text(label + ": ", labelColor)) + private Component statLine(String icon, TextColor color, String label, String value) { + return Component.text(" " + icon + " ", color) + .append(Component.text(label + ": ", color)) .append(Component.text(value, NamedTextColor.WHITE)); }