Prevent new self disguises glitching out

This commit is contained in:
libraryaddict 2014-09-27 13:11:47 +12:00
parent f2d148d0af
commit 2e960f1abf
2 changed files with 9 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -284,7 +284,7 @@ public class PacketsManager {
spawnPackets[0] = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
StructureModifier<Object> 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();