mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix some team color docs and added hasColor (#7602)
This commit is contained in:
parent
f5e81eab58
commit
ea12aebb11
2 changed files with 20 additions and 4 deletions
|
@ -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 <b>color</b>
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ boolean hasColor();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the color of the team.
|
||||
+ * <br>
|
||||
+ * 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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue