Skip to content

Commit

Permalink
team color parameter may be null, causing NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
rgnter authored and electronicboy committed May 24, 2022
1 parent 123cad5 commit d8108b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions patches/server/0008-Adventure.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3387,10 +3387,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..df1288e2e89716bba5ef73d2cdeb9a567f46a297 100644
index 81f16dc1ed6e102af298600db75cab21a09bc00f..18d5a26c34c848241c306241b3ad9825b5a0b9a9 100644
--- a/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();
}
Expand Down Expand Up @@ -3446,8 +3446,9 @@ index 81f16dc1ed6e102af298600db75cab21a09bc00f..df1288e2e89716bba5ef73d2cdeb9a56
+ CraftScoreboard scoreboard = checkState();
+ if (color == null) {
+ 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

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0493-Fix-CraftTeam-null-check.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 df1288e2e89716bba5ef73d2cdeb9a567f46a297..af4ab4be3722d3349f7f71da062dee493cd2aafe 100644
index 8aa74d3d04efc88f48b79b677d63d464e1fef89e..0e1fbecfc3062ceac425607507caa54b0d007130 100644
--- a/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
public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0817-Improve-scoreboard-entries.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 af4ab4be3722d3349f7f71da062dee493cd2aafe..d1844550bafa381a6dd88702dabef6de39be0907 100644
index 0e1fbecfc3062ceac425607507caa54b0d007130..32a160ca2e53cc76a31cb401d1509c5e643041dd 100644
--- a/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 {
}
}

Expand Down
6 changes: 3 additions & 3 deletions patches/server/0834-Multiple-Entries-with-Scoreboards.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 d1844550bafa381a6dd88702dabef6de39be0907..d3d9641862f4746469bca946ef6d89a88f15698b 100644
index 32a160ca2e53cc76a31cb401d1509c5e643041dd..29c49cf0e6e7f523e362730f0aa17fc4b18aceb9 100644
--- a/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);
}

Expand All @@ -95,7 +95,7 @@ index d1844550bafa381a6dd88702dabef6de39be0907..d3d9641862f4746469bca946ef6d89a8
@Override
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
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;
}

Expand Down

0 comments on commit d8108b5

Please sign in to comment.