diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java b/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java index e00da50..e19f4fb 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java +++ b/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java @@ -268,16 +268,7 @@ public class ChatColorUtil { public static class ChatValueGradient { - //private record GradientValueColor(float value, ChatColor color) { } // Java 16 - private static class GradientValueColor { - private final float value; - private final TextColor color; - public GradientValueColor(float value, TextColor color) { - this.value = value; this.color = color; - } - public float value() { return value; } - public TextColor color() { return color; } - } + private record GradientValueColor(float value, TextColor color) { } // Java 16 List colors = new ArrayList<>(); diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java b/Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java index d22f8fb..86c9e9d 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java +++ b/Core/src/main/java/fr/pandacube/lib/core/chat/ChatStatic.java @@ -5,6 +5,7 @@ import java.util.Objects; import fr.pandacube.lib.core.chat.Chat.FormatableChat; import fr.pandacube.lib.core.util.Log; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.md_5.bungee.api.chat.BaseComponent; @@ -77,13 +78,14 @@ public abstract class ChatStatic { } public static FormatableChat playerNameText(String legacyText) { - return legacyText(legacyText).white(); + FormatableChat fc = legacyText(legacyText); + fc.builder.colorIfAbsent(NamedTextColor.WHITE); + return fc; } public static FormatableChat playerNameComponent(Component c) { FormatableChat fc = chatComponent(c); - if (c.color() == null) - fc.white(); + fc.builder.colorIfAbsent(NamedTextColor.WHITE); return fc; } diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreBoardUtil.java b/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreBoardUtil.java deleted file mode 100644 index c748efa..0000000 --- a/Paper/src/main/java/fr/pandacube/lib/paper/util/ScoreBoardUtil.java +++ /dev/null @@ -1,129 +0,0 @@ -package fr.pandacube.lib.paper.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Score; -import org.bukkit.scoreboard.Scoreboard; - -import fr.pandacube.lib.core.chat.Chat; -import fr.pandacube.lib.core.chat.ChatUtil; -import net.md_5.bungee.api.ChatColor; - -public class ScoreBoardUtil { - - /** - * Update the sidebar of the provided scoreboard, with the given title and lines. - * - * @param scBrd the scoreboard - * @param title the title of the sidebar - * @param lines the lines that have to be displayed. Null values are treated as empty lines. - * The lines support legacy formatting only, and will be truncated to 40 characters. - * Lines present multiple times will have hidden characters appended to make them different. - * Vanilla Java Edition clients only display the 15 first lines. - * @implNote The implementation makes sure that the minimum amount of data is transmitted to the client, - * to reduce bandwith usage and avoid the sidebar flickering. - *