From 730adbbf42adf0ce2fdcd54df73f7fb7cabd5ccd Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 31 Jan 2014 09:42:03 -0500 Subject: [PATCH] [Bleeding] Don't allow null display names. Fixes BUKKIT-5254 Currently, plugins can set a player's display name to null, which could cause issues for other calls to getDisplayName that aren't expecting a null value. This changes setDisplayName to follow the same logic as setPlayerListName, which sets the player's name back to their unmodified "vanilla" name if it receives a null value as a parameter. --- src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 7c427fa38b..55ea121b54 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -169,7 +169,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setDisplayName(final String name) { - getHandle().displayName = name; + getHandle().displayName = name == null ? getName() : name; } @Override