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.Material;
import org.bukkit.entity.Damageable; import org.bukkit.entity.Damageable;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -219,6 +220,10 @@ public class PacketHandlerSpawn implements IPacketHandler {
} else if (disguise.isMobDisguise() || disguise.getType() == DisguiseType.ARMOR_STAND) { } else if (disguise.isMobDisguise() || disguise.getType() == DisguiseType.ARMOR_STAND) {
Vector vec = disguisedEntity.getVelocity(); 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); PacketContainer spawnEntity = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
packets.addPacket(spawnEntity); 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, public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer,
Entity entity) { Entity entity) {
// If the disguise isnt a misc or the disguised is the same type // 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; return;
} }