fix nullability of playerlist header/footer, closes #5290

This commit is contained in:
MiniDigger 2021-03-03 20:08:25 +01:00 committed by Mariell Hoversholm
parent 45bc531dd3
commit 5b5989b213

View file

@ -1978,7 +1978,7 @@ index 96b55867d8bfbc85cb290da9b320ec74b9dbb179..513d24877c336b6e32f2ef939788d108
player.activeContainer.addSlotListener(player); player.activeContainer.addSlotListener(player);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1cbf0fd6c0f2d1fa62f944162cd9320c640d8530..5f55e3816f1e00be6e4ae573cc09eb19b59adf74 100644 index 1cbf0fd6c0f2d1fa62f944162cd9320c640d8530..32a8a074600519ec2075229bbd02ca1e4123a70f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -240,14 +240,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -240,14 +240,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2045,14 +2045,14 @@ index 1cbf0fd6c0f2d1fa62f944162cd9320c640d8530..5f55e3816f1e00be6e4ae573cc09eb19
@Override @Override
public void setPlayerListHeader(String header) { public void setPlayerListHeader(String header) {
- this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true); - this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true);
+ this.playerListHeader = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure + this.playerListHeader = header == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure
updatePlayerListHeaderFooter(); updatePlayerListHeaderFooter();
} }
@Override @Override
public void setPlayerListFooter(String footer) { public void setPlayerListFooter(String footer) {
- this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true); - this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true);
+ this.playerListFooter = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure + this.playerListFooter = footer == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure
updatePlayerListHeaderFooter(); updatePlayerListHeaderFooter();
} }
@ -2060,8 +2060,8 @@ index 1cbf0fd6c0f2d1fa62f944162cd9320c640d8530..5f55e3816f1e00be6e4ae573cc09eb19
public void setPlayerListHeaderFooter(String header, String footer) { public void setPlayerListHeaderFooter(String header, String footer) {
- this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true); - this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true);
- this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true); - this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true);
+ this.playerListHeader = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure + this.playerListHeader = header == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure
+ this.playerListFooter = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure + this.playerListFooter = footer == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure
updatePlayerListHeaderFooter(); updatePlayerListHeaderFooter();
} }