From 852d8c9f2b8d1d117b83bf65062368f3e9d46649 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 5 Feb 2020 14:29:04 +1300 Subject: [PATCH] Set custom name dynamically on start --- .../disguise/disguisetypes/PlayerDisguise.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 333cc03a..370b0711 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -413,7 +413,17 @@ public class PlayerDisguise extends TargetedDisguise { } } - if (getName().equals("") && getEntity() != null) { + if (isDynamicName()) { + String name = getEntity().getCustomName(); + + if (name == null) { + name = ""; + } + + if (!getName().equals(name)) { + setName(name); + } + } else if (getName().equals("") && getEntity() != null) { String name = getEntity().getCustomName(); if (name == null || name.isEmpty()) {