diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index c1f483a86c..2915685d4d 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -4115,13 +4115,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + void suffix(@Nullable net.kyori.adventure.text.Component suffix) throws IllegalStateException, IllegalArgumentException; + + /** ++ * Checks if the team has a color specified ++ * ++ * @return true if it has a color ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ boolean hasColor(); ++ ++ /** + * Gets the color of the team. + *
+ * This only sets the team outline, other occurrences of colors such as in + * names are handled by prefixes / suffixes. + * -+ * @return team color, defaults to {@link ChatColor#RESET} ++ * @return team color + * @throws IllegalStateException if this team has been unregistered ++ * @throws IllegalStateException if the team doesn't have a color ++ * @see #hasColor() + */ + @NotNull net.kyori.adventure.text.format.TextColor color() throws IllegalStateException; + @@ -4131,8 +4141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * This only sets the team outline, other occurrences of colors such as in + * names are handled by prefixes / suffixes. + * -+ * @param color new color, must be non-null. Use {@link ChatColor#RESET} for -+ * no color ++ * @param color new color, null for no color + */ + void color(@Nullable net.kyori.adventure.text.format.NamedTextColor color); + // Paper end diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 2d5adcd866..12786e021f 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -3427,6 +3427,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + team.setPlayerSuffix(io.papermc.paper.adventure.PaperAdventure.asVanilla(suffix)); + } + @Override ++ public boolean hasColor() { ++ CraftScoreboard scoreboard = checkState(); ++ return this.team.getColor().getColor() != null; ++ } ++ @Override + public net.kyori.adventure.text.format.TextColor color() throws IllegalStateException { + CraftScoreboard scoreboard = checkState(); + if (team.getColor().getColor() == null) throw new IllegalStateException("Team colors must have hex values"); @@ -3436,8 +3441,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + @Override + public void color(net.kyori.adventure.text.format.NamedTextColor color) { -+ if (color == null) color = net.kyori.adventure.text.format.NamedTextColor.WHITE; + CraftScoreboard scoreboard = checkState(); ++ if (color == null) { ++ this.team.setColor(net.minecraft.ChatFormatting.RESET); ++ } + team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color)); + } + // Paper end