From c239116c9dbf74bbbd97463ca75b9cd1babe1ab9 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 12 Jul 2016 00:36:47 +1200 Subject: [PATCH] Fixed typo in InsentientWatcher, self disguises crashing on metachange --- pom.xml | 2 +- .../disguise/disguisetypes/FlagWatcher.java | 12 +++++++++++- .../disguisetypes/watchers/AgeableWatcher.java | 2 -- .../disguisetypes/watchers/InsentientWatcher.java | 2 +- .../disguise/utilities/PacketsManager.java | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index f5675830..c074d1b9 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 LibsDisguises LibsDisguises - 9.0.8 + 9.0.8-SNAPSHOT src diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index ea1bdefe..a19f237d 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -457,7 +457,17 @@ public class FlagWatcher { try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); + if (player == getDisguise().getEntity()) + { + PacketContainer temp = packet.shallowClone(); + temp.getIntegers().write(0, DisguiseAPI.getSelfDisguiseId()); + + ProtocolLibrary.getProtocolManager().sendServerPacket(player, temp); + } + else + { + ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet); + } } catch (InvocationTargetException e) { diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java index 31209688..09b354ed 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/AgeableWatcher.java @@ -5,7 +5,6 @@ import me.libraryaddict.disguise.disguisetypes.FlagType; public class AgeableWatcher extends InsentientWatcher { - public AgeableWatcher(Disguise disguise) { super(disguise); @@ -36,5 +35,4 @@ public class AgeableWatcher extends InsentientWatcher setValue(FlagType.AGEABLE_BABY, isBaby); sendData(FlagType.AGEABLE_BABY); } - } diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java index 59762f46..b559ec43 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/InsentientWatcher.java @@ -50,6 +50,6 @@ public class InsentientWatcher extends LivingWatcher private boolean getInsentientFlag(int i) { - return ((byte) getValue(FlagType.PLAYER_SKIN) & 1 << i) != 0; + return ((byte) getValue(FlagType.INSENTIENT_META) & 1 << i) != 0; } } diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index bac5fc76..23ac0d5a 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -894,7 +894,7 @@ public class PacketsManager List watchableObjects = disguise.getWatcher() .convert(packets[0].getWatchableCollectionModifier().read(0)); - packets[0] = new PacketContainer(sentPacket.getType()); + packets[0] = new PacketContainer(Server.ENTITY_METADATA); StructureModifier newMods = packets[0].getModifier();