Move where armor destroy packet is sent

This commit is contained in:
libraryaddict 2020-05-10 20:01:30 +12:00
parent e8c7a48c47
commit a0398c4d02
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -116,8 +116,6 @@ public abstract class Disguise {
return DisguiseUtilities.reverse(multiName); return DisguiseUtilities.reverse(multiName);
} }
public abstract double getHeight();
public void setMultiName(String... name) { public void setMultiName(String... name) {
if (name.length == 1 && name[0].isEmpty()) { if (name.length == 1 && name[0].isEmpty()) {
name = new String[0]; name = new String[0];
@ -135,6 +133,8 @@ public abstract class Disguise {
sendArmorStands(oldName); sendArmorStands(oldName);
} }
public abstract double getHeight();
protected void sendArmorStands(String[] oldName) { protected void sendArmorStands(String[] oldName) {
ArrayList<PacketContainer> packets = DisguiseUtilities.getNamePackets(this, oldName); ArrayList<PacketContainer> packets = DisguiseUtilities.getNamePackets(this, oldName);
@ -890,6 +890,20 @@ public abstract class Disguise {
} }
} }
if (getMultiNameLength() > 0) {
PacketContainer packet = new PacketContainer(Server.ENTITY_DESTROY);
packet.getIntegerArrays().write(0, Arrays.copyOf(getArmorstandIds(), getMultiNameLength()));
try {
for (Player player : DisguiseUtilities.getPerverts(this)) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
}
}
catch (InvocationTargetException e) {
e.printStackTrace();
}
}
// If this disguise is active // If this disguise is active
// Remove the disguise from the current disguises. // Remove the disguise from the current disguises.
if (DisguiseUtilities.removeDisguise((TargetedDisguise) this)) { if (DisguiseUtilities.removeDisguise((TargetedDisguise) this)) {
@ -945,20 +959,6 @@ public abstract class Disguise {
} }
} }
if (getMultiNameLength() > 0) {
PacketContainer packet = new PacketContainer(Server.ENTITY_DESTROY);
packet.getIntegerArrays().write(0, Arrays.copyOf(getArmorstandIds(), getMultiNameLength()));
try {
for (Player player : DisguiseUtilities.getPerverts(this)) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
}
}
catch (InvocationTargetException e) {
e.printStackTrace();
}
}
return true; return true;
} }