From d0bb5021bfb2fc97a72f84849e3d5b0a2938ce44 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 25 Mar 2020 15:53:08 +1300 Subject: [PATCH] Empty names will now hide the name on PlayerDisguise --- .../disguisetypes/PlayerDisguise.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index b02897f0..8ee30699 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -50,12 +50,7 @@ public class PlayerDisguise extends TargetedDisguise { } public PlayerDisguise(String name) { - this(); - - setName(name); - setSkin(name); - - createDisguise(); + this(name, name); } public PlayerDisguise(String name, String skinToUse) { @@ -201,6 +196,12 @@ public class PlayerDisguise extends TargetedDisguise { if (isDisguiseInUse() && isNameVisible()) { if (stopDisguise()) { + if (getName().isEmpty() && !name.isEmpty()) { + setNameVisible(true); + } else if (name.isEmpty()) { + setNameVisible(false); + } + playerName = name; if (gameProfile != null) { @@ -215,6 +216,12 @@ public class PlayerDisguise extends TargetedDisguise { throw new IllegalStateException("Unable to restart disguise"); } } else { + if (getName() != null&&!getName().isEmpty() && name.isEmpty()) { + setNameVisible(false); + } else if (!name.isEmpty()) { + setNameVisible(true); + } + playerName = name; if (gameProfile != null) {