Fix some team color docs and added hasColor (#7602)

This commit is contained in:
Jake Potrebic
2022-04-23 18:37:10 -07:00
parent f5e81eab58
commit ea12aebb11
2 changed files with 20 additions and 4 deletions

View File

@@ -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