Add sounds for self disguises player to not be cancelled.

This commit is contained in:
libraryaddict 2013-12-15 02:33:11 +13:00
parent d4461f7ade
commit b026f30087
2 changed files with 4 additions and 3 deletions

View File

@ -551,11 +551,11 @@ public abstract class Disguise {
* Can the disguised view himself as the disguise
*/
public void setViewSelfDisguise(boolean viewSelfDisguise) {
if (this.viewSelfDisguise != viewSelfDisguise) {
if (isSelfDisguiseVisible() != viewSelfDisguise) {
this.viewSelfDisguise = viewSelfDisguise;
if (getEntity() != null && getEntity() instanceof Player) {
if (DisguiseAPI.getDisguise((Player) getEntity(), getEntity()) == this) {
if (viewSelfDisguise) {
if (isSelfDisguiseVisible()) {
DisguiseUtilities.setupFakeDisguise(this);
} else
DisguiseUtilities.removeSelfDisguise((Player) getEntity());

View File

@ -764,7 +764,8 @@ public class PacketsManager {
}
else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {
if (DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer()).isSelfDisguiseSoundsReplaced()
Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer());
if (disguise.getType() != DisguiseType.PLAYER && disguise.isSelfDisguiseSoundsReplaced()
&& (Byte) event.getPacket().getModifier().read(1) == (ReflectionManager.isAfter17() ? 2 : 1)) {
event.setCancelled(true);
}