diff options
author | Jake Potrebic <[email protected]> | 2022-04-23 18:37:10 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-04-23 18:37:10 -0700 |
commit | 4dc78ae8b98fb90ba5c72fd0f1346b62221ce7c3 (patch) | |
tree | c399b8a2fe48f551be48274f753e1ae80adf7bee /patches | |
parent | 5b85ee37e20de15e0798391085b01229e4e0d6fd (diff) | |
download | Paper-4dc78ae8b98fb90ba5c72fd0f1346b62221ce7c3.tar.gz Paper-4dc78ae8b98fb90ba5c72fd0f1346b62221ce7c3.zip |
Fix some team color docs and added hasColor (#7602)
Diffstat (limited to 'patches')
-rw-r--r-- | patches/api/0005-Adventure.patch | 33 | ||||
-rw-r--r-- | patches/api/0346-Improve-scoreboard-entries.patch | 10 | ||||
-rw-r--r-- | patches/api/0355-Multiple-Entries-with-Scoreboards.patch | 6 | ||||
-rw-r--r-- | patches/server/0008-Adventure.patch | 13 | ||||
-rw-r--r-- | patches/server/0493-Fix-CraftTeam-null-check.patch | 4 | ||||
-rw-r--r-- | patches/server/0820-Improve-scoreboard-entries.patch | 4 | ||||
-rw-r--r-- | patches/server/0837-Multiple-Entries-with-Scoreboards.patch | 6 |
7 files changed, 46 insertions, 30 deletions
diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index 8202f4d33b..f520811536 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -4052,10 +4052,10 @@ index 5c855dbd0da895392f7a6e92cdc90782baf614ad..1ada91d790abedbc9b3aeb6e96467a0d /** diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java -index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df1506858168d20d 100644 +index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..07a9fa68075a2c5f5a4a7519976b506526d95ca0 100644 --- a/src/main/java/org/bukkit/scoreboard/Team.java +++ b/src/main/java/org/bukkit/scoreboard/Team.java -@@ -22,14 +22,93 @@ public interface Team { +@@ -22,14 +22,102 @@ public interface Team { */ @NotNull String getName() throws IllegalStateException; @@ -4115,13 +4115,23 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 + 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 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 + * 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 @@ -4149,7 +4158,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 String getDisplayName() throws IllegalStateException; /** -@@ -39,7 +118,9 @@ public interface Team { +@@ -39,7 +127,9 @@ public interface Team { * @throws IllegalArgumentException if displayName is longer than 128 * characters. * @throws IllegalStateException if this team has been unregistered @@ -4159,7 +4168,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 void setDisplayName(@NotNull String displayName) throws IllegalStateException, IllegalArgumentException; /** -@@ -47,8 +128,10 @@ public interface Team { +@@ -47,8 +137,10 @@ public interface Team { * * @return Team prefix * @throws IllegalStateException if this team has been unregistered @@ -4170,7 +4179,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 String getPrefix() throws IllegalStateException; /** -@@ -59,7 +142,9 @@ public interface Team { +@@ -59,7 +151,9 @@ public interface Team { * @throws IllegalArgumentException if prefix is longer than 64 * characters * @throws IllegalStateException if this team has been unregistered @@ -4180,7 +4189,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 void setPrefix(@NotNull String prefix) throws IllegalStateException, IllegalArgumentException; /** -@@ -67,8 +152,10 @@ public interface Team { +@@ -67,8 +161,10 @@ public interface Team { * * @return the team's current suffix * @throws IllegalStateException if this team has been unregistered @@ -4191,7 +4200,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 String getSuffix() throws IllegalStateException; /** -@@ -79,7 +166,9 @@ public interface Team { +@@ -79,7 +175,9 @@ public interface Team { * @throws IllegalArgumentException if suffix is longer than 64 * characters * @throws IllegalStateException if this team has been unregistered @@ -4201,7 +4210,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 void setSuffix(@NotNull String suffix) throws IllegalStateException, IllegalArgumentException; /** -@@ -90,8 +179,10 @@ public interface Team { +@@ -90,8 +188,10 @@ public interface Team { * * @return team color, defaults to {@link ChatColor#RESET} * @throws IllegalStateException if this team has been unregistered @@ -4212,7 +4221,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685 ChatColor getColor() throws IllegalStateException; /** -@@ -102,7 +193,9 @@ public interface Team { +@@ -102,7 +202,9 @@ public interface Team { * * @param color new color, must be non-null. Use {@link ChatColor#RESET} for * no color diff --git a/patches/api/0346-Improve-scoreboard-entries.patch b/patches/api/0346-Improve-scoreboard-entries.patch index 34c175dad7..7918390f63 100644 --- a/patches/api/0346-Improve-scoreboard-entries.patch +++ b/patches/api/0346-Improve-scoreboard-entries.patch @@ -110,10 +110,10 @@ index 1ada91d790abedbc9b3aeb6e96467a0d78560f15..fc3456bb79f2fe1504359455b937c162 + // Paper end } diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java -index d5b39fb4fc16a342b5661e08df1506858168d20d..2b93692204a74ea0def513a54ddf77a40c64d3d2 100644 +index 07a9fa68075a2c5f5a4a7519976b506526d95ca0..51205a71d243195fdf35515374a1e9ef5df26bc0 100644 --- a/src/main/java/org/bukkit/scoreboard/Team.java +++ b/src/main/java/org/bukkit/scoreboard/Team.java -@@ -301,9 +301,8 @@ public interface Team { +@@ -310,9 +310,8 @@ public interface Team { * @throws IllegalArgumentException if player is null * @throws IllegalStateException if this team has been unregistered * @see #addEntry(String) @@ -124,7 +124,7 @@ index d5b39fb4fc16a342b5661e08df1506858168d20d..2b93692204a74ea0def513a54ddf77a4 void addPlayer(@NotNull OfflinePlayer player) throws IllegalStateException, IllegalArgumentException; /** -@@ -325,9 +324,8 @@ public interface Team { +@@ -334,9 +333,8 @@ public interface Team { * @throws IllegalArgumentException if player is null * @throws IllegalStateException if this team has been unregistered * @see #removeEntry(String) @@ -135,7 +135,7 @@ index d5b39fb4fc16a342b5661e08df1506858168d20d..2b93692204a74ea0def513a54ddf77a4 boolean removePlayer(@NotNull OfflinePlayer player) throws IllegalStateException, IllegalArgumentException; /** -@@ -355,9 +353,8 @@ public interface Team { +@@ -364,9 +362,8 @@ public interface Team { * @throws IllegalArgumentException if player is null * @throws IllegalStateException if this team has been unregistered * @see #hasEntry(String) @@ -146,7 +146,7 @@ index d5b39fb4fc16a342b5661e08df1506858168d20d..2b93692204a74ea0def513a54ddf77a4 boolean hasPlayer(@NotNull OfflinePlayer player) throws IllegalArgumentException, IllegalStateException; /** * Checks to see if the specified entry is a member of this team. -@@ -388,6 +385,42 @@ public interface Team { +@@ -397,6 +394,42 @@ public interface Team { */ void setOption(@NotNull Option option, @NotNull OptionStatus status) throws IllegalStateException; diff --git a/patches/api/0355-Multiple-Entries-with-Scoreboards.patch b/patches/api/0355-Multiple-Entries-with-Scoreboards.patch index e1d867d054..378ab2020f 100644 --- a/patches/api/0355-Multiple-Entries-with-Scoreboards.patch +++ b/patches/api/0355-Multiple-Entries-with-Scoreboards.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Multiple Entries with Scoreboards diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java -index 2b93692204a74ea0def513a54ddf77a40c64d3d2..04c8cc55a2fe19c888aba842775cc66648dddb0c 100644 +index 51205a71d243195fdf35515374a1e9ef5df26bc0..0f5c49d41c9460da0ba913b4ca8bef375f2c23df 100644 --- a/src/main/java/org/bukkit/scoreboard/Team.java +++ b/src/main/java/org/bukkit/scoreboard/Team.java -@@ -316,6 +316,60 @@ public interface Team { +@@ -325,6 +325,60 @@ public interface Team { */ void addEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException; @@ -69,7 +69,7 @@ index 2b93692204a74ea0def513a54ddf77a40c64d3d2..04c8cc55a2fe19c888aba842775cc666 /** * Removes the player from this team. * -@@ -338,6 +392,56 @@ public interface Team { +@@ -347,6 +401,56 @@ public interface Team { */ boolean removeEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException; diff --git a/patches/server/0008-Adventure.patch b/patches/server/0008-Adventure.patch index 02a72c3a7a..5c336dff9c 100644 --- a/patches/server/0008-Adventure.patch +++ b/patches/server/0008-Adventure.patch @@ -3385,10 +3385,10 @@ index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..5f2af880619e01a03e05258ae1f9fa58 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index 81f16dc1ed6e102af298600db75cab21a09bc00f..f86776aa42bd5520f8aaeaa46bb93ec4d5b4e27d 100644 +index 81f16dc1ed6e102af298600db75cab21a09bc00f..df1288e2e89716bba5ef73d2cdeb9a567f46a297 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -@@ -28,6 +28,55 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { +@@ -28,6 +28,62 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { return this.team.getName(); } @@ -3427,6 +3427,11 @@ index 81f16dc1ed6e102af298600db75cab21a09bc00f..f86776aa42bd5520f8aaeaa46bb93ec4 + 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 81f16dc1ed6e102af298600db75cab21a09bc00f..f86776aa42bd5520f8aaeaa46bb93ec4 + } + @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 diff --git a/patches/server/0493-Fix-CraftTeam-null-check.patch b/patches/server/0493-Fix-CraftTeam-null-check.patch index 61de747dfd..a86676f8a2 100644 --- a/patches/server/0493-Fix-CraftTeam-null-check.patch +++ b/patches/server/0493-Fix-CraftTeam-null-check.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix CraftTeam null check diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index f86776aa42bd5520f8aaeaa46bb93ec4d5b4e27d..2b87a652798cb632fe76bf20e9e7f8cb8bfb3b7b 100644 +index df1288e2e89716bba5ef73d2cdeb9a567f46a297..af4ab4be3722d3349f7f71da062dee493cd2aafe 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -@@ -253,7 +253,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { +@@ -260,7 +260,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @Override public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { diff --git a/patches/server/0820-Improve-scoreboard-entries.patch b/patches/server/0820-Improve-scoreboard-entries.patch index ee3bcefafe..4db7c1f77b 100644 --- a/patches/server/0820-Improve-scoreboard-entries.patch +++ b/patches/server/0820-Improve-scoreboard-entries.patch @@ -52,10 +52,10 @@ index 944080939ceaf2db8bcd7d3c01f4b97440e35cc1..0102c475b6e49777c1e24c32e5eff299 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index 2b87a652798cb632fe76bf20e9e7f8cb8bfb3b7b..47f2e8824fff51f4271e7aa61e233d57e3ca2942 100644 +index af4ab4be3722d3349f7f71da062dee493cd2aafe..d1844550bafa381a6dd88702dabef6de39be0907 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -@@ -302,6 +302,26 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { +@@ -309,6 +309,26 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { } } diff --git a/patches/server/0837-Multiple-Entries-with-Scoreboards.patch b/patches/server/0837-Multiple-Entries-with-Scoreboards.patch index 2f9e8e9118..21fc65abbd 100644 --- a/patches/server/0837-Multiple-Entries-with-Scoreboards.patch +++ b/patches/server/0837-Multiple-Entries-with-Scoreboards.patch @@ -70,10 +70,10 @@ index 610d312b9c8f6c8d1f102e8ba2fe9fc2cc3e98c5..3a4a0727ad44322e3ba85512cd077808 public void onObjectiveAdded(Objective objective) { super.onObjectiveAdded(objective); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index 47f2e8824fff51f4271e7aa61e233d57e3ca2942..be5e4c2f3c552e0438ed1cc660e411c41fd13df7 100644 +index d1844550bafa381a6dd88702dabef6de39be0907..d3d9641862f4746469bca946ef6d89a88f15698b 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -@@ -226,6 +226,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { +@@ -233,6 +233,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { scoreboard.board.addPlayerToTeam(entry, team); } @@ -95,7 +95,7 @@ index 47f2e8824fff51f4271e7aa61e233d57e3ca2942..be5e4c2f3c552e0438ed1cc660e411c4 @Override public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException { Validate.notNull(player, "OfflinePlayer cannot be null"); -@@ -245,6 +260,28 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { +@@ -252,6 +267,28 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { return true; } |