Fixed tablist not being sent properly on undisguise

This commit is contained in:
libraryaddict 2018-02-15 22:15:56 +13:00
parent 0d7370cc81
commit a6bb739e62

View File

@ -530,6 +530,21 @@ public abstract class Disguise {
} }
} }
// If this disguise is active
// Remove the disguise from the current disguises.
if (DisguiseUtilities.removeDisguise((TargetedDisguise) this)) {
if (getEntity() instanceof Player) {
DisguiseUtilities.removeSelfDisguise((Player) getEntity());
}
// Better refresh the entity to undisguise it
if (getEntity().isValid()) {
DisguiseUtilities.refreshTrackers((TargetedDisguise) this);
} else {
DisguiseUtilities.destroyEntity((TargetedDisguise) this);
}
}
if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) { if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) {
PlayerInfoData playerInfo = new PlayerInfoData( PlayerInfoData playerInfo = new PlayerInfoData(
ReflectionManager.getGameProfile((Player) getEntity()), 0, ReflectionManager.getGameProfile((Player) getEntity()), 0,
@ -553,21 +568,6 @@ public abstract class Disguise {
e.printStackTrace(); e.printStackTrace();
} }
} }
// If this disguise is active
// Remove the disguise from the current disguises.
if (DisguiseUtilities.removeDisguise((TargetedDisguise) this)) {
if (getEntity() instanceof Player) {
DisguiseUtilities.removeSelfDisguise((Player) getEntity());
}
// Better refresh the entity to undisguise it
if (getEntity().isValid()) {
DisguiseUtilities.refreshTrackers((TargetedDisguise) this);
} else {
DisguiseUtilities.destroyEntity((TargetedDisguise) this);
}
}
} else { } else {
// Loop through the disguises because it could be used with a unknown entity id. // Loop through the disguises because it could be used with a unknown entity id.
HashMap<Integer, HashSet<TargetedDisguise>> future = DisguiseUtilities.getFutureDisguises(); HashMap<Integer, HashSet<TargetedDisguise>> future = DisguiseUtilities.getFutureDisguises();