From 2e960f1abff46a3dc96263f60bd1425ca23da41f Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 27 Sep 2014 13:11:47 +1200 Subject: [PATCH] Prevent new self disguises glitching out --- .../libraryaddict/disguise/disguisetypes/Disguise.java | 9 ++++++++- .../libraryaddict/disguise/utilities/PacketsManager.java | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java index 74303b90..290ab4b7 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -706,10 +706,17 @@ public abstract class Disguise { task = Bukkit.getScheduler().runTaskTimer(plugin, velocityRunnable, 1, 1); // Stick the disguise in the disguises bin DisguiseUtilities.addDisguise(entity.getUniqueId(), (TargetedDisguise) this); + if (isSelfDisguiseVisible() && getEntity() instanceof Player) { + DisguiseUtilities.removeSelfDisguise((Player) getEntity()); + } // Resend the disguised entity's packet DisguiseUtilities.refreshTrackers((TargetedDisguise) this); // If he is a player, then self disguise himself - DisguiseUtilities.setupFakeDisguise(this); + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { + public void run() { + DisguiseUtilities.setupFakeDisguise(Disguise.this); + } + }, 2); return true; } } diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index d9905562..0f3bb47c 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -284,7 +284,7 @@ public class PacketsManager { spawnPackets[0] = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING); StructureModifier mods = spawnPackets[0].getModifier(); mods.write(0, disguisedEntity.getEntityId()); - mods.write(1, disguise.getType().getTypeId()); // TODO + mods.write(1, disguise.getType().getTypeId()); double d1 = 3.9D; double d2 = vec.getX(); double d3 = vec.getY();