Update multiline names

This commit is contained in:
libraryaddict 2020-10-10 07:34:19 +13:00
parent 0213f7f034
commit 76f3383c16

View File

@ -2866,7 +2866,9 @@ public class DisguiseUtilities {
public static ArrayList<PacketContainer> getNamePackets(Disguise disguise, String[] internalOldNames) { public static ArrayList<PacketContainer> getNamePackets(Disguise disguise, String[] internalOldNames) {
ArrayList<PacketContainer> packets = new ArrayList<>(); ArrayList<PacketContainer> packets = new ArrayList<>();
String[] newNames = new String[0]; String[] newNames =
(disguise instanceof PlayerDisguise && !((PlayerDisguise) disguise).isNameVisible()) ? new String[0] :
reverse(disguise.getMultiName());
int[] standIds = disguise.getArmorstandIds(); int[] standIds = disguise.getArmorstandIds();
int[] destroyIds = new int[0]; int[] destroyIds = new int[0];
@ -2875,19 +2877,16 @@ public class DisguiseUtilities {
internalOldNames = new String[]{StringUtils.join(internalOldNames, "\\n")}; internalOldNames = new String[]{StringUtils.join(internalOldNames, "\\n")};
} }
if (newNames.length > 0) {
newNames = new String[]{StringUtils.join(newNames, "\\n")};
}
if (!disguise.isPlayerDisguise() || ((PlayerDisguise) disguise).isNameVisible()) { if (!disguise.isPlayerDisguise() || ((PlayerDisguise) disguise).isNameVisible()) {
if (disguise.getMultiName().length > 1) { if (disguise.getMultiName().length > 1) {
getLogger().info("Multiline names is a premium feature, sorry!"); getLogger().info("Multiline names is a premium feature, sorry!");
} }
if (disguise.getMultiName().length > 0) {
newNames = new String[]{StringUtils.join(disguise.getMultiName(), "\\n")};
} }
} }
} else {
newNames = (disguise instanceof PlayerDisguise && !((PlayerDisguise) disguise).isNameVisible()) ?
new String[0] : reverse(disguise.getMultiName());
}
if (internalOldNames.length > newNames.length) { if (internalOldNames.length > newNames.length) {
// Destroy packet // Destroy packet