Add compatibility for older versions of MC for sounds

This commit is contained in:
libraryaddict 2013-12-08 15:36:11 +13:00
parent a178fbace7
commit 585f8ad116

View File

@ -612,7 +612,7 @@ public class PacketsManager {
} }
} }
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) { } else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {
if ((Byte) mods.read(1) == 2) { if ((Byte) mods.read(1) == (ReflectionManager.isAfter17() ? 2 : 1)) {
// It made a damage animation // It made a damage animation
Entity entity = event.getPacket().getEntityModifier(observer.getWorld()).read(0); Entity entity = event.getPacket().getEntityModifier(observer.getWorld()).read(0);
Disguise disguise = DisguiseAPI.getDisguise(observer, entity); Disguise disguise = DisguiseAPI.getDisguise(observer, entity);
@ -766,7 +766,7 @@ public class PacketsManager {
else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) { else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {
if (DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer()).isSelfDisguiseSoundsReplaced() if (DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer()).isSelfDisguiseSoundsReplaced()
&& (Byte) event.getPacket().getModifier().read(1) == 2) { && (Byte) event.getPacket().getModifier().read(1) == (ReflectionManager.isAfter17() ? 2 : 1)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }