team color parameter may be null, causing NPE

This commit is contained in:
rgnter 2022-05-21 11:27:12 +02:00 committed by Shane Freeder
parent 123cad5d3e
commit d8108b5416
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
4 changed files with 11 additions and 10 deletions

View File

@ -3387,10 +3387,10 @@ index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..5f2af880619e01a03e05258ae1f9fa58
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 81f16dc1ed6e102af298600db75cab21a09bc00f..df1288e2e89716bba5ef73d2cdeb9a567f46a297 100644 index 81f16dc1ed6e102af298600db75cab21a09bc00f..18d5a26c34c848241c306241b3ad9825b5a0b9a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -28,6 +28,62 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -28,6 +28,63 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
return this.team.getName(); return this.team.getName();
} }
@ -3446,8 +3446,9 @@ index 81f16dc1ed6e102af298600db75cab21a09bc00f..df1288e2e89716bba5ef73d2cdeb9a56
+ CraftScoreboard scoreboard = checkState(); + CraftScoreboard scoreboard = checkState();
+ if (color == null) { + if (color == null) {
+ this.team.setColor(net.minecraft.ChatFormatting.RESET); + this.team.setColor(net.minecraft.ChatFormatting.RESET);
+ } else {
+ this.team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color));
+ } + }
+ team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color));
+ } + }
+ // Paper end + // Paper end

View File

@ -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 diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index df1288e2e89716bba5ef73d2cdeb9a567f46a297..af4ab4be3722d3349f7f71da062dee493cd2aafe 100644 index 8aa74d3d04efc88f48b79b677d63d464e1fef89e..0e1fbecfc3062ceac425607507caa54b0d007130 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -260,7 +260,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -261,7 +261,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
@Override @Override
public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException {

View File

@ -52,10 +52,10 @@ index 944080939ceaf2db8bcd7d3c01f4b97440e35cc1..0102c475b6e49777c1e24c32e5eff299
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index af4ab4be3722d3349f7f71da062dee493cd2aafe..d1844550bafa381a6dd88702dabef6de39be0907 100644 index 0e1fbecfc3062ceac425607507caa54b0d007130..32a160ca2e53cc76a31cb401d1509c5e643041dd 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -309,6 +309,26 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -310,6 +310,26 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
} }
} }

View File

@ -70,10 +70,10 @@ index 610d312b9c8f6c8d1f102e8ba2fe9fc2cc3e98c5..3a4a0727ad44322e3ba85512cd077808
public void onObjectiveAdded(Objective objective) { public void onObjectiveAdded(Objective objective) {
super.onObjectiveAdded(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 diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index d1844550bafa381a6dd88702dabef6de39be0907..d3d9641862f4746469bca946ef6d89a88f15698b 100644 index 32a160ca2e53cc76a31cb401d1509c5e643041dd..29c49cf0e6e7f523e362730f0aa17fc4b18aceb9 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -233,6 +233,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -234,6 +234,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
scoreboard.board.addPlayerToTeam(entry, team); scoreboard.board.addPlayerToTeam(entry, team);
} }
@ -95,7 +95,7 @@ index d1844550bafa381a6dd88702dabef6de39be0907..d3d9641862f4746469bca946ef6d89a8
@Override @Override
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException { public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
Validate.notNull(player, "OfflinePlayer cannot be null"); Validate.notNull(player, "OfflinePlayer cannot be null");
@@ -252,6 +267,28 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -253,6 +268,28 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
return true; return true;
} }