Fixed trying to use properties before they were added

This commit is contained in:
libraryaddict 2014-07-26 11:10:48 +12:00
parent f81e7bba6b
commit 0eba652926
3 changed files with 7 additions and 4 deletions

View File

@ -151,7 +151,7 @@ public class PlayerDisguise extends TargetedDisguise {
if (skinToUse.length() > 16) {
this.skinToUse = skinToUse.substring(0, 16);
}
if (LibVersion.is1_7()) {
if (LibVersion.is1_7_6()) {
currentLookup = new LibsProfileLookup() {
@Override

View File

@ -20,6 +20,7 @@ import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise.TargetType;
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -344,7 +345,7 @@ public class DisguiseUtilities {
getAddedByPlugins().remove(disguise.getName().toLowerCase());
}
if (DisguiseAPI.isDisguiseInUse(disguise)
&& (!gameProfile.getName().equals(disguise.getName()) || !gameProfile.getProperties().isEmpty())) {
&& (!gameProfile.getName().equals(disguise.getName()) || (LibVersion.is1_7_6() && !gameProfile.getProperties().isEmpty()))) {
// TODO Resend for UUID? Might need to in the future.
DisguiseUtilities.refreshTrackers(disguise);
}
@ -371,7 +372,7 @@ public class DisguiseUtilities {
Player player = Bukkit.getPlayerExact(playerName);
if (player != null) {
WrappedGameProfile gameProfile = ReflectionManager.getGameProfile(player);
if (!gameProfile.getProperties().isEmpty()) {
if (!LibVersion.is1_7_6() || !gameProfile.getProperties().isEmpty()) {
gameProfiles.put(playerName, gameProfile);
return gameProfile;
}

View File

@ -364,7 +364,9 @@ public class ReflectionManager {
public static WrappedGameProfile getGameProfileWithThisSkin(UUID uuid, String playerName, WrappedGameProfile profileWithSkin) {
try {
WrappedGameProfile gameProfile = new WrappedGameProfile(uuid != null ? uuid : UUID.randomUUID(), playerName);
if (LibVersion.is1_7_6()) {
gameProfile.getProperties().putAll(profileWithSkin.getProperties());
}
return gameProfile;
} catch (Exception ex) {
ex.printStackTrace();