Fix calling saveGameProfile ignored

This commit is contained in:
libraryaddict 2017-07-11 04:41:04 +12:00
parent e76f4f4ae6
commit 7045c5998c
2 changed files with 15 additions and 4 deletions

View File

@ -735,7 +735,9 @@ public class DisguiseUtilities {
WrappedGameProfile gameProfile = ReflectionManager.getGameProfile(player); WrappedGameProfile gameProfile = ReflectionManager.getGameProfile(player);
if (!gameProfile.getProperties().isEmpty()) { if (!gameProfile.getProperties().isEmpty()) {
if (DisguiseConfig.isSaveGameProfiles()) {
addGameProfile(playerName, gameProfile); addGameProfile(playerName, gameProfile);
}
return gameProfile; return gameProfile;
} }
@ -755,7 +757,9 @@ public class DisguiseUtilities {
return; return;
} }
if (DisguiseConfig.isSaveGameProfiles()) {
addGameProfile(playerName, gameProfile); addGameProfile(playerName, gameProfile);
}
if (runnables.containsKey(playerName)) { if (runnables.containsKey(playerName)) {
for (Object obj : runnables.remove(playerName)) { for (Object obj : runnables.remove(playerName)) {

View File

@ -449,7 +449,7 @@ public class ReflectionManager {
public static Object getNmsItem(ItemStack itemstack) { public static Object getNmsItem(ItemStack itemstack) {
try { try {
return craftItemClass.getDeclaredMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack); return craftItemClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack);
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -784,6 +784,13 @@ public class ReflectionManager {
catch (Exception ex) { catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} else if (val instanceof ItemStack) {
val = getNmsItem((ItemStack) val);
if (val == null)
return Optional.absent();
else
return Optional.of(val);
} }
} else if (value instanceof Vector3F) { } else if (value instanceof Vector3F) {
Vector3F angle = (Vector3F) value; Vector3F angle = (Vector3F) value;
@ -797,7 +804,7 @@ public class ReflectionManager {
} }
} else if (value instanceof Direction) { } else if (value instanceof Direction) {
try { try {
return (Enum) getNmsMethod("EnumDirection", "fromType1", int.class) return getNmsMethod("EnumDirection", "fromType1", int.class)
.invoke(null, ((Direction) value).ordinal()); .invoke(null, ((Direction) value).ordinal());
} }
catch (Exception ex) { catch (Exception ex) {