Fixed player disguises not having proper metadata

This commit is contained in:
libraryaddict 2016-11-29 03:00:03 +13:00
parent d8483c70ee
commit 2e1b1b7a06

View File

@ -58,7 +58,7 @@ public class PacketsManager {
public static class LibsPackets { public static class LibsPackets {
private ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>(); private ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>();
private HashMap<Integer, ArrayList<PacketContainer>> delayedPackets = new HashMap<Integer, ArrayList<PacketContainer>>(); private HashMap<Integer, ArrayList<PacketContainer>> delayedPackets = new HashMap<Integer, ArrayList<PacketContainer>>();
private boolean isSpawnPlayer; private boolean isSpawnPacket;
private Disguise disguise; private Disguise disguise;
private boolean doNothing; private boolean doNothing;
@ -79,7 +79,7 @@ public class PacketsManager {
} }
public void setPacketType(PacketType type) { public void setPacketType(PacketType type) {
isSpawnPlayer = type.name().contains("SPAWN_"); isSpawnPacket = type.name().contains("SPAWN_");
} }
public void addPacket(PacketContainer packet) { public void addPacket(PacketContainer packet) {
@ -122,7 +122,7 @@ public class PacketsManager {
e.printStackTrace(); e.printStackTrace();
} }
if (isSpawnPlayer) { if (isSpawnPacket) {
PacketsManager.removeCancel(disguise, observer); PacketsManager.removeCancel(disguise, observer);
} }
} }
@ -392,8 +392,6 @@ public class PacketsManager {
PacketContainer metaPacket = new PacketContainer(Play.Server.ENTITY_METADATA); PacketContainer metaPacket = new PacketContainer(Play.Server.ENTITY_METADATA);
newWatcher = createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher()); newWatcher = createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher());
newWatcher.setObject(new WrappedDataWatcherObject(FlagType.ENTITY_META.getIndex(), Registry.get(Byte.class)),
(byte) 0);
metaPacket.getIntegers().write(0, entityId); // Id metaPacket.getIntegers().write(0, entityId); // Id
metaPacket.getWatchableCollectionModifier().write(0, newWatcher.getWatchableObjects()); metaPacket.getWatchableCollectionModifier().write(0, newWatcher.getWatchableObjects());