Display name should never be null

This commit is contained in:
Riley Park 2021-02-23 16:48:02 -08:00
parent bf2f8aeaf6
commit 6ae2121257
No known key found for this signature in database
GPG key ID: D831AF236C834E45

View file

@ -1829,7 +1829,7 @@ index 96b55867d8bfbc85cb290da9b320ec74b9dbb179..513d24877c336b6e32f2ef939788d108
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
index 8428ef53e0408c4a7f74cc03e7e238be9c2f1888..fcc6a3d3b68b6a63ee08b9d66c77f4d63ae27551 100644
index 8428ef53e0408c4a7f74cc03e7e238be9c2f1888..aac172afc8343f325612fdc608630560fb52ca19 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -239,14 +239,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -1842,7 +1842,7 @@ index 8428ef53e0408c4a7f74cc03e7e238be9c2f1888..fcc6a3d3b68b6a63ee08b9d66c77f4d6
@Override
public void setDisplayName(final String name) {
+ this.getHandle().adventure$displayName = name != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(name) : null; if (true) return; // Paper
+ this.getHandle().adventure$displayName = name != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(name) : net.kyori.adventure.text.Component.text(this.getName()); if (true) return; // Paper
getHandle().displayName = name == null ? getName() : name;
}
@ -2026,7 +2026,7 @@ index 8428ef53e0408c4a7f74cc03e7e238be9c2f1888..fcc6a3d3b68b6a63ee08b9d66c77f4d6
+
+ @Override
+ public void displayName(final net.kyori.adventure.text.Component displayName) {
+ this.getHandle().adventure$displayName = displayName;
+ this.getHandle().adventure$displayName = displayName != null ? displayName : net.kyori.adventure.text.Component.text(this.getName());
+ }
+
+ @Override