Player is no longer invisible to himself when undisguising

This commit is contained in:
Andrew 2013-08-01 19:56:27 +12:00
parent ec69f17aa3
commit 0981a0a88a

View File

@ -61,13 +61,13 @@ import com.comphenix.protocol.reflect.StructureModifier;
public class DisguiseAPI {
private static HashMap<Entity, Disguise> disguises = new HashMap<Entity, Disguise>();
private static boolean hearSelfDisguise;
private static LibsDisguises libsDisguises;
private static PacketListener packetListener;
private static HashMap<Integer, Integer> selfDisguisesIds = new HashMap<Integer, Integer>();
private static boolean sendVelocity;
private static boolean soundsEnabled;
private static HashMap<Integer, Integer> selfDisguisesIds = new HashMap<Integer, Integer>();
private static boolean viewDisguises;
private static boolean hearSelfDisguise;
private static PacketListener viewDisguisesListener;
private synchronized static Disguise access(Entity entity, Disguise... args) {
@ -83,6 +83,10 @@ public class DisguiseAPI {
return null;
}
public static boolean canHearSelfDisguise() {
return hearSelfDisguise;
}
/**
* @param Player
* - The player to disguise
@ -124,16 +128,6 @@ public class DisguiseAPI {
}
}
public static void setHearSelfDisguise(boolean replaceSound) {
if (hearSelfDisguise != replaceSound) {
hearSelfDisguise = replaceSound;
}
}
public static boolean canHearSelfDisguise() {
return hearSelfDisguise;
}
private static Disguise get(Entity obj) {
return access(obj);
}
@ -452,12 +446,27 @@ public class DisguiseAPI {
ex.printStackTrace();
}
selfDisguisesIds.remove(player.getEntityId());
EntityPlayer entityplayer = ((CraftPlayer) player).getHandle();
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) entityplayer.world).tracker.trackedEntities
.get(player.getEntityId());
if (tracker != null) {
tracker.trackedPlayers.remove(entityplayer);
}
PacketContainer packetMetadata = new PacketContainer(Packets.Server.ENTITY_METADATA);
StructureModifier<Object> mods = packetMetadata.getModifier();
mods.write(0, player.getEntityId());
mods.write(1, entityplayer.getDataWatcher().c());
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packetMetadata);
} catch (Exception ex) {
ex.printStackTrace();
}
}
EntityPlayer entityplayer = ((CraftPlayer) player).getHandle();
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) entityplayer.world).tracker.trackedEntities.get(player
.getEntityId());
if (tracker != null) {
tracker.trackedPlayers.remove(entityplayer);
}
public static void setHearSelfDisguise(boolean replaceSound) {
if (hearSelfDisguise != replaceSound) {
hearSelfDisguise = replaceSound;
}
}