Player is no longer invisible to himself when undisguising
This commit is contained in:
parent
ec69f17aa3
commit
0981a0a88a
@ -61,13 +61,13 @@ import com.comphenix.protocol.reflect.StructureModifier;
|
|||||||
public class DisguiseAPI {
|
public class DisguiseAPI {
|
||||||
|
|
||||||
private static HashMap<Entity, Disguise> disguises = new HashMap<Entity, Disguise>();
|
private static HashMap<Entity, Disguise> disguises = new HashMap<Entity, Disguise>();
|
||||||
|
private static boolean hearSelfDisguise;
|
||||||
private static LibsDisguises libsDisguises;
|
private static LibsDisguises libsDisguises;
|
||||||
private static PacketListener packetListener;
|
private static PacketListener packetListener;
|
||||||
|
private static HashMap<Integer, Integer> selfDisguisesIds = new HashMap<Integer, Integer>();
|
||||||
private static boolean sendVelocity;
|
private static boolean sendVelocity;
|
||||||
private static boolean soundsEnabled;
|
private static boolean soundsEnabled;
|
||||||
private static HashMap<Integer, Integer> selfDisguisesIds = new HashMap<Integer, Integer>();
|
|
||||||
private static boolean viewDisguises;
|
private static boolean viewDisguises;
|
||||||
private static boolean hearSelfDisguise;
|
|
||||||
private static PacketListener viewDisguisesListener;
|
private static PacketListener viewDisguisesListener;
|
||||||
|
|
||||||
private synchronized static Disguise access(Entity entity, Disguise... args) {
|
private synchronized static Disguise access(Entity entity, Disguise... args) {
|
||||||
@ -83,6 +83,10 @@ public class DisguiseAPI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canHearSelfDisguise() {
|
||||||
|
return hearSelfDisguise;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Player
|
* @param Player
|
||||||
* - The player to disguise
|
* - 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) {
|
private static Disguise get(Entity obj) {
|
||||||
return access(obj);
|
return access(obj);
|
||||||
}
|
}
|
||||||
@ -452,12 +446,27 @@ public class DisguiseAPI {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
selfDisguisesIds.remove(player.getEntityId());
|
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());
|
public static void setHearSelfDisguise(boolean replaceSound) {
|
||||||
if (tracker != null) {
|
if (hearSelfDisguise != replaceSound) {
|
||||||
tracker.trackedPlayers.remove(entityplayer);
|
hearSelfDisguise = replaceSound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user