Let setDynamicName work on player disguises and player entities

This commit is contained in:
libraryaddict 2021-06-07 20:01:27 +12:00
parent 43aa37a9ec
commit 9593225f8e
2 changed files with 22 additions and 4 deletions

View File

@ -380,7 +380,13 @@ public abstract class Disguise {
}
if (isDynamicName()) {
String name = getEntity().getCustomName();
String name;
if (getEntity() instanceof Player) {
name = DisguiseUtilities.translateAlternateColorCodes(DisguiseUtilities.getDisplayName(getEntity()));
} else {
name = getEntity().getCustomName();
}
if (name == null) {
name = "";
@ -1014,8 +1020,14 @@ public abstract class Disguise {
setExpires(DisguiseConfig.isDynamicExpiry() ? 240 * 20 : System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(330));
}
if (isDynamicName() && !isPlayerDisguise()) {
String name = getEntity().getCustomName();
if (isDynamicName()) {
String name;
if (getEntity() instanceof Player) {
name = DisguiseUtilities.translateAlternateColorCodes(DisguiseUtilities.getDisplayName(getEntity()));
} else {
name = getEntity().getCustomName();
}
if (name == null) {
name = "";

View File

@ -648,7 +648,13 @@ public class PlayerDisguise extends TargetedDisguise {
}
if (isDynamicName()) {
String name = getEntity().getCustomName();
String name;
if (getEntity() instanceof Player) {
name = DisguiseUtilities.translateAlternateColorCodes(DisguiseUtilities.getDisplayName(getEntity()));
} else {
name = getEntity().getCustomName();
}
if (name == null) {
name = "";