Cancel velocities on squid disguises

This commit is contained in:
libraryaddict 2020-05-04 18:25:09 +12:00
parent 4014aab004
commit 04271be455
No known key found for this signature in database
GPG key ID: 052E4FBCD257AEA4
2 changed files with 7 additions and 1 deletions

View file

@ -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);

View file

@ -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;
}