From a0398c4d0237da59692b7199c48b9c59fc6e755d Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 10 May 2020 20:01:30 +1200 Subject: [PATCH] Move where armor destroy packet is sent --- .../disguise/disguisetypes/Disguise.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index 140fa0d3..7fbbac0e 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -116,8 +116,6 @@ public abstract class Disguise { return DisguiseUtilities.reverse(multiName); } - public abstract double getHeight(); - public void setMultiName(String... name) { if (name.length == 1 && name[0].isEmpty()) { name = new String[0]; @@ -135,6 +133,8 @@ public abstract class Disguise { sendArmorStands(oldName); } + public abstract double getHeight(); + protected void sendArmorStands(String[] oldName) { ArrayList 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 // Remove the disguise from the current disguises. 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; }