From fa1340f7a66a49bfbd02fdcdd1c8c0eed9941efb Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 17 Jul 2018 06:36:08 +1000 Subject: [PATCH] SPIGOT-4022: Improve utility of Entity.getName for non-players --- src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 576567774e..64cfc95150 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -568,7 +568,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public String getName() { - return getHandle().getName(); + return CraftChatMessage.fromComponent(getHandle().getDisplayName(), EnumChatFormat.WHITE); } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 269bbd8e77..073c8acf2c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -92,6 +92,11 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return getHandle().sleepTicks; } + @Override + public String getName() { + return getHandle().getName(); + } + public boolean isOp() { return op; }