From 04271be45539f0746da3270d70db58125a9a4bbf Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 4 May 2020 18:25:09 +1200 Subject: [PATCH] Cancel velocities on squid disguises --- .../utilities/packets/packethandlers/PacketHandlerSpawn.java | 5 +++++ .../packets/packethandlers/PacketHandlerVelocity.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java index b2b40fa4..9ae797c9 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java @@ -24,6 +24,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Damageable; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; @@ -219,6 +220,10 @@ public class PacketHandlerSpawn implements IPacketHandler { } else if (disguise.isMobDisguise() || disguise.getType() == DisguiseType.ARMOR_STAND) { Vector vec = disguisedEntity.getVelocity(); + if (disguise.getType() == DisguiseType.SQUID && disguisedEntity.getType() != EntityType.SQUID) { + vec = new Vector(); + } + PacketContainer spawnEntity = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING); packets.addPacket(spawnEntity); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerVelocity.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerVelocity.java index fcc6f5c6..be18efaf 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerVelocity.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerVelocity.java @@ -22,7 +22,8 @@ public class PacketHandlerVelocity implements IPacketHandler { public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer, Entity entity) { // If the disguise isnt a misc or the disguised is the same type - if (!disguise.getType().isMisc() || DisguiseType.getType(entity) == disguise.getType()) { + if ((!disguise.getType().isMisc() && disguise.getType() != DisguiseType.SQUID) || + DisguiseType.getType(entity) == disguise.getType()) { return; }