From a70932da4d106c63ad6b6422847329a4a111d330 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 23 May 2014 10:33:50 +1200 Subject: [PATCH] Forgot to add a hook here.. --- .../disguise/utilities/PacketsManager.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index d069bc2e..963e6dc3 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -99,27 +99,29 @@ public class PacketsManager { ArrayList packets = new ArrayList(); // This sends the armor packets so that the player isn't naked. // Please note it only sends the packets that wouldn't be sent normally - for (int nmsSlot = 0; nmsSlot < 5; nmsSlot++) { - int armorSlot = nmsSlot - 1; - if (armorSlot < 0) - armorSlot = 4; - ItemStack itemstack = disguise.getWatcher().getItemStack(armorSlot); - if (itemstack != null && itemstack.getTypeId() != 0) { - ItemStack item = null; - if (disguisedEntity instanceof LivingEntity) { - if (nmsSlot == 0) { - item = ((LivingEntity) disguisedEntity).getEquipment().getItemInHand(); - } else { - item = ((LivingEntity) disguisedEntity).getEquipment().getArmorContents()[armorSlot]; + if (DisguiseConfig.isEnquipmentPacketsEnabled()) { + for (int nmsSlot = 0; nmsSlot < 5; nmsSlot++) { + int armorSlot = nmsSlot - 1; + if (armorSlot < 0) + armorSlot = 4; + ItemStack itemstack = disguise.getWatcher().getItemStack(armorSlot); + if (itemstack != null && itemstack.getTypeId() != 0) { + ItemStack item = null; + if (disguisedEntity instanceof LivingEntity) { + if (nmsSlot == 0) { + item = ((LivingEntity) disguisedEntity).getEquipment().getItemInHand(); + } else { + item = ((LivingEntity) disguisedEntity).getEquipment().getArmorContents()[armorSlot]; + } + } + if (item == null || item.getType() == Material.AIR) { + PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT); + StructureModifier mods = packet.getModifier(); + mods.write(0, disguisedEntity.getEntityId()); + mods.write(1, nmsSlot); + mods.write(2, ReflectionManager.getNmsItem(itemstack)); + packets.add(packet); } - } - if (item == null || item.getType() == Material.AIR) { - PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT); - StructureModifier mods = packet.getModifier(); - mods.write(0, disguisedEntity.getEntityId()); - mods.write(1, nmsSlot); - mods.write(2, ReflectionManager.getNmsItem(itemstack)); - packets.add(packet); } } }