diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java index a6833af7..6f906f16 100644 --- a/src/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -55,6 +55,8 @@ public class DisguiseAPI { public static void disguiseToAll(Entity entity, Disguise disguise) { if (disguise == null) return; + if (disguise.getWatcher() != null) + disguise = disguise.clone(); put(entity instanceof Player ? ((Player) entity).getName() : entity.getUniqueId(), disguise); disguise.constructWatcher(entity.getType(), entity.getEntityId()); refresh(entity); diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java index 03162063..6f16cdaa 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java @@ -44,6 +44,11 @@ public class Disguise { replaceSounds = doSounds; } + public Disguise clone() { + Disguise disguise = new Disguise(getType(), replaceSounds()); + return disguise; + } + public PacketContainer[] constructPacket(org.bukkit.entity.Entity e) { PacketContainer[] spawnPackets = new PacketContainer[2]; ProtocolManager manager = ProtocolLibrary.getProtocolManager(); @@ -260,11 +265,11 @@ public class Disguise { else tempWatcher = new FlagWatcher(entityId); } - if (this instanceof MobDisguise) { + if (this instanceof MobDisguise && !((MobDisguise) this).isAdult()) { if (tempWatcher instanceof AgeableWatcher) - tempWatcher.setValue(12, ((MobDisguise) this).isAdult() ? 0 : -24000); + tempWatcher.setValue(12, -24000); else if (tempWatcher instanceof ZombieWatcher) - tempWatcher.setValue(12, (byte) (((MobDisguise) this).isAdult() ? 0 : 1)); + tempWatcher.setValue(12, (byte) 1); } HashMap disguiseValues = Values.getMetaValues(getType()); HashMap entityValues = Values.getMetaValues(DisguiseType.getType(type)); diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java index 62a4962f..6af422a6 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java @@ -26,6 +26,11 @@ public class MiscDisguise extends Disguise { this(disguiseType, true, id, data); } + public MiscDisguise clone() { + MiscDisguise disguise = new MiscDisguise(getType(), replaceSounds(), getId(), getData()); + return disguise; + } + public int getData() { return data; } diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java index 246439c4..2768e8dd 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/PlayerDisguise.java @@ -14,6 +14,11 @@ public class PlayerDisguise extends Disguise { playerName = name; } + public PlayerDisguise clone() { + PlayerDisguise disguise = new PlayerDisguise(getName(), replaceSounds()); + return disguise; + } + public String getName() { return playerName; }