mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-04 08:59:47 +01:00
Update dynamic name for non-player disguises
This commit is contained in:
parent
0fe54d6683
commit
f6eb0f14b7
@ -102,6 +102,9 @@ public abstract class Disguise {
|
||||
private boolean tallDisguisesVisible = DisguiseConfig.isTallSelfDisguises();
|
||||
private String[] multiName = new String[0];
|
||||
private transient int[] armorstandIds = new int[0];
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean dynamicName;
|
||||
|
||||
public Disguise(DisguiseType disguiseType) {
|
||||
this.disguiseType = disguiseType;
|
||||
@ -126,6 +129,10 @@ public abstract class Disguise {
|
||||
String[] oldName = multiName;
|
||||
multiName = name;
|
||||
|
||||
if (Arrays.equals(oldName, name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDisguiseInUse()) {
|
||||
return;
|
||||
}
|
||||
@ -192,6 +199,7 @@ public abstract class Disguise {
|
||||
disguise.setVelocitySent(isVelocitySent());
|
||||
disguise.setModifyBoundingBox(isModifyBoundingBox());
|
||||
disguise.multiName = Arrays.copyOf(multiName, multiName.length);
|
||||
disguise.setDynamicName(isDynamicName());
|
||||
|
||||
if (getWatcher() != null) {
|
||||
disguise.setWatcher(getWatcher().clone(disguise));
|
||||
@ -367,16 +375,20 @@ public abstract class Disguise {
|
||||
new ComponentBuilder(LibsMsg.ACTION_BAR_MESSAGE.get(getDisguiseName())).create());
|
||||
}
|
||||
|
||||
if (Disguise.this instanceof PlayerDisguise && ((PlayerDisguise) Disguise.this).isDynamicName()) {
|
||||
if (isDynamicName()) {
|
||||
String name = getEntity().getCustomName();
|
||||
|
||||
if (name == null) {
|
||||
name = "";
|
||||
}
|
||||
|
||||
if (isPlayerDisguise()) {
|
||||
if (!((PlayerDisguise) Disguise.this).getName().equals(name)) {
|
||||
((PlayerDisguise) Disguise.this).setName(name);
|
||||
}
|
||||
} else {
|
||||
getWatcher().setCustomName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1161,6 +1173,16 @@ public abstract class Disguise {
|
||||
System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(330));
|
||||
}
|
||||
|
||||
if (isDynamicName() && !isPlayerDisguise()) {
|
||||
String name = getEntity().getCustomName();
|
||||
|
||||
if (name == null) {
|
||||
name = "";
|
||||
}
|
||||
|
||||
getWatcher().setCustomName(name);
|
||||
}
|
||||
|
||||
makeBossBar();
|
||||
|
||||
return true;
|
||||
|
@ -31,9 +31,6 @@ public class PlayerDisguise extends TargetedDisguise {
|
||||
*/
|
||||
private boolean explicitNameVisible = false;
|
||||
private UUID uuid = UUID.randomUUID();
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean dynamicName;
|
||||
private volatile DisguiseUtilities.DScoreTeam scoreboardName;
|
||||
@Getter
|
||||
private boolean upsideDown;
|
||||
@ -226,7 +223,6 @@ public class PlayerDisguise extends TargetedDisguise {
|
||||
disguise.setName(getName());
|
||||
disguise.nameVisible = isNameVisible();
|
||||
disguise.explicitNameVisible = explicitNameVisible;
|
||||
disguise.setDynamicName(isDynamicName());
|
||||
disguise.setUpsideDown(isUpsideDown());
|
||||
|
||||
clone(disguise);
|
||||
|
Loading…
Reference in New Issue
Block a user