From 3a2e7602fb69d752932601ddd23436c7bf8ebbb3 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 28 Jan 2020 15:13:59 +1300 Subject: [PATCH] Add for player disguises name to inherit custom names from entities --- .../disguise/disguisetypes/PlayerDisguise.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 8c99d2c0..43c96acb 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -15,6 +15,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.LibsPremium; import me.libraryaddict.disguise.utilities.reflection.LibsProfileLookup; import me.libraryaddict.disguise.utilities.reflection.ReflectionManager; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.entity.Entity; @@ -313,6 +314,16 @@ public class PlayerDisguise extends TargetedDisguise { setSkin(gameProfile); } } + + if (getName().equals("") && getEntity() != null) { + String name = getEntity().getCustomName(); + + if (name == null || name.isEmpty()) { + name = getEntity().getType().name(); + } + + setName(name); + } } boolean result = super.startDisguise();