Empty names will now hide the name on PlayerDisguise

This commit is contained in:
libraryaddict 2020-03-25 15:53:08 +13:00
parent 203f2adeb5
commit d0bb5021bf
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -50,12 +50,7 @@ public class PlayerDisguise extends TargetedDisguise {
} }
public PlayerDisguise(String name) { public PlayerDisguise(String name) {
this(); this(name, name);
setName(name);
setSkin(name);
createDisguise();
} }
public PlayerDisguise(String name, String skinToUse) { public PlayerDisguise(String name, String skinToUse) {
@ -201,6 +196,12 @@ public class PlayerDisguise extends TargetedDisguise {
if (isDisguiseInUse() && isNameVisible()) { if (isDisguiseInUse() && isNameVisible()) {
if (stopDisguise()) { if (stopDisguise()) {
if (getName().isEmpty() && !name.isEmpty()) {
setNameVisible(true);
} else if (name.isEmpty()) {
setNameVisible(false);
}
playerName = name; playerName = name;
if (gameProfile != null) { if (gameProfile != null) {
@ -215,6 +216,12 @@ public class PlayerDisguise extends TargetedDisguise {
throw new IllegalStateException("Unable to restart disguise"); throw new IllegalStateException("Unable to restart disguise");
} }
} else { } else {
if (getName() != null&&!getName().isEmpty() && name.isEmpty()) {
setNameVisible(false);
} else if (!name.isEmpty()) {
setNameVisible(true);
}
playerName = name; playerName = name;
if (gameProfile != null) { if (gameProfile != null) {