From f14ee20e7caa8c5207332c70dcba9aba8453e0a3 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 10 Feb 2014 12:15:58 +1300 Subject: [PATCH] The disguised client no longer appears to mount a vechile if he is not living. This will bug out slightly however. --- .../disguise/utilities/PacketsManager.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index 18d60911..21ee8d7d 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -71,14 +71,15 @@ public class PacketsManager { PacketType.Play.Server.SPAWN_ENTITY_EXPERIENCE_ORB, PacketType.Play.Server.SPAWN_ENTITY, PacketType.Play.Server.SPAWN_ENTITY_LIVING, PacketType.Play.Server.SPAWN_ENTITY_PAINTING, PacketType.Play.Server.COLLECT, PacketType.Play.Server.UPDATE_ATTRIBUTES, - PacketType.Play.Server.ENTITY_EQUIPMENT, PacketType.Play.Server.BED, PacketType.Play.Server.ENTITY_STATUS) { + PacketType.Play.Server.ENTITY_EQUIPMENT, PacketType.Play.Server.BED, PacketType.Play.Server.ENTITY_STATUS, + PacketType.Play.Server.ATTACH_ENTITY) { @Override public void onPacketSending(PacketEvent event) { final Player observer = event.getPlayer(); // First get the entity, the one sending this packet StructureModifier entityModifer = event.getPacket().getEntityModifier(observer.getWorld()); - org.bukkit.entity.Entity entity = entityModifer.read((PacketType.Play.Server.COLLECT == event.getPacketType() ? 1 - : 0)); + org.bukkit.entity.Entity entity = entityModifer.read((PacketType.Play.Server.COLLECT == event.getPacketType() + || PacketType.Play.Server.ATTACH_ENTITY == event.getPacketType() ? 1 : 0)); // If the entity is the same as the sender. Don't disguise! // Prevents problems and there is no advantage to be gained. if (entity == observer) @@ -1130,6 +1131,12 @@ public class PacketsManager { packets = new PacketContainer[0]; } + else if (sentPacket.getType() == PacketType.Play.Server.ATTACH_ENTITY) { + if (disguise.getType().isMisc()) { + packets = new PacketContainer[0]; + } + } + // Else if the packet is sending entity metadata else if (sentPacket.getType() == PacketType.Play.Server.ENTITY_METADATA) { List watchableObjects = disguise.getWatcher().convert(