From b026f3008739df50564c3645ee6c73702bdc9ec9 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 15 Dec 2013 02:33:11 +1300 Subject: [PATCH] Add sounds for self disguises player to not be cancelled. --- src/me/libraryaddict/disguise/disguisetypes/Disguise.java | 4 ++-- src/me/libraryaddict/disguise/utilities/PacketsManager.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java index f7a5c21d..46475797 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -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()); diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index f2653097..96017c9a 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -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); }