Refresh all disguises using that playername. Not just the caller
This commit is contained in:
parent
c454ea1cd7
commit
5f03b75eb7
@ -14,6 +14,7 @@ import me.libraryaddict.disguise.DisguiseAPI;
|
|||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
|
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
||||||
@ -269,11 +270,11 @@ public class DisguiseUtilities {
|
|||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getProfile(final Disguise disguise, final String playerName) {
|
public static Object getProfile(final String playerName) {
|
||||||
Player player = Bukkit.getPlayerExact(playerName);
|
Player player = Bukkit.getPlayerExact(playerName);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
return ReflectionManager.getGameProfile(player);
|
return ReflectionManager.getGameProfile(player);
|
||||||
} else if (disguise != null) {
|
} else {
|
||||||
if (gameProfiles.containsKey(playerName)) {
|
if (gameProfiles.containsKey(playerName)) {
|
||||||
if (gameProfiles.get(playerName) != null) {
|
if (gameProfiles.get(playerName) != null) {
|
||||||
return gameProfiles.get(playerName);
|
return gameProfiles.get(playerName);
|
||||||
@ -293,10 +294,17 @@ public class DisguiseUtilities {
|
|||||||
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
|
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
|
||||||
gameProfiles.put(playerName, gameProfile);
|
gameProfiles.put(playerName, gameProfile);
|
||||||
}
|
}
|
||||||
if (DisguiseUtilities.isDisguiseInUse(disguise)) {
|
for (HashSet<TargetedDisguise> disguises : DisguiseUtilities.getDisguises().values()) {
|
||||||
|
for (TargetedDisguise disguise : disguises) {
|
||||||
|
if (disguise.getType() == DisguiseType.PLAYER
|
||||||
|
&& ((PlayerDisguise) disguise).getName().equals(playerName)) {
|
||||||
DisguiseUtilities.refreshTrackers((TargetedDisguise) disguise);
|
DisguiseUtilities.refreshTrackers((TargetedDisguise) disguise);
|
||||||
if (disguise.getEntity() instanceof Player && disguise.isSelfDisguiseVisible()) {
|
if (disguise.getEntity() instanceof Player
|
||||||
DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise);
|
&& disguise.isSelfDisguiseVisible()) {
|
||||||
|
DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(),
|
||||||
|
disguise);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class PacketsManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object gameProfile = null;
|
Object gameProfile = null;
|
||||||
gameProfile = DisguiseUtilities.getProfile(disguise, ((PlayerDisguise) disguise).getName());
|
gameProfile = DisguiseUtilities.getProfile(((PlayerDisguise) disguise).getName());
|
||||||
spawnPackets[0].getModifier().write(1, gameProfile);
|
spawnPackets[0].getModifier().write(1, gameProfile);
|
||||||
}
|
}
|
||||||
StructureModifier<Integer> intMods = spawnPackets[0].getIntegers();
|
StructureModifier<Integer> intMods = spawnPackets[0].getIntegers();
|
||||||
|
Loading…
Reference in New Issue
Block a user