mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +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;
|
+ 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.
|
+ * Gets the color of the team.
|
||||||
+ * <br>
|
+ * <br>
|
||||||
+ * This only sets the team outline, other occurrences of colors such as in
|
+ * This only sets the team outline, other occurrences of colors such as in
|
||||||
+ * names are handled by prefixes / suffixes.
|
+ * 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 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;
|
+ @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
|
+ * This only sets the team outline, other occurrences of colors such as in
|
||||||
+ * names are handled by prefixes / suffixes.
|
+ * names are handled by prefixes / suffixes.
|
||||||
+ *
|
+ *
|
||||||
+ * @param color new color, must be non-null. Use {@link ChatColor#RESET} for
|
+ * @param color new color, null for no color
|
||||||
+ * no color
|
|
||||||
+ */
|
+ */
|
||||||
+ void color(@Nullable net.kyori.adventure.text.format.NamedTextColor color);
|
+ void color(@Nullable net.kyori.adventure.text.format.NamedTextColor color);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
|
@ -3427,6 +3427,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ team.setPlayerSuffix(io.papermc.paper.adventure.PaperAdventure.asVanilla(suffix));
|
+ team.setPlayerSuffix(io.papermc.paper.adventure.PaperAdventure.asVanilla(suffix));
|
||||||
+ }
|
+ }
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ public boolean hasColor() {
|
||||||
|
+ CraftScoreboard scoreboard = checkState();
|
||||||
|
+ return this.team.getColor().getColor() != null;
|
||||||
|
+ }
|
||||||
|
+ @Override
|
||||||
+ public net.kyori.adventure.text.format.TextColor color() throws IllegalStateException {
|
+ public net.kyori.adventure.text.format.TextColor color() throws IllegalStateException {
|
||||||
+ CraftScoreboard scoreboard = checkState();
|
+ CraftScoreboard scoreboard = checkState();
|
||||||
+ if (team.getColor().getColor() == null) throw new IllegalStateException("Team colors must have hex values");
|
+ if (team.getColor().getColor() == null) throw new IllegalStateException("Team colors must have hex values");
|
||||||
|
@ -3436,8 +3441,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void color(net.kyori.adventure.text.format.NamedTextColor color) {
|
+ public void color(net.kyori.adventure.text.format.NamedTextColor color) {
|
||||||
+ if (color == null) color = net.kyori.adventure.text.format.NamedTextColor.WHITE;
|
|
||||||
+ CraftScoreboard scoreboard = checkState();
|
+ CraftScoreboard scoreboard = checkState();
|
||||||
|
+ if (color == null) {
|
||||||
|
+ this.team.setColor(net.minecraft.ChatFormatting.RESET);
|
||||||
|
+ }
|
||||||
+ team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color));
|
+ team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
Loading…
Reference in a new issue