diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index a9d7d955..be2661c7 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -735,7 +735,9 @@ public class DisguiseUtilities { WrappedGameProfile gameProfile = ReflectionManager.getGameProfile(player); if (!gameProfile.getProperties().isEmpty()) { - addGameProfile(playerName, gameProfile); + if (DisguiseConfig.isSaveGameProfiles()) { + addGameProfile(playerName, gameProfile); + } return gameProfile; } @@ -755,7 +757,9 @@ public class DisguiseUtilities { return; } - addGameProfile(playerName, gameProfile); + if (DisguiseConfig.isSaveGameProfiles()) { + addGameProfile(playerName, gameProfile); + } if (runnables.containsKey(playerName)) { for (Object obj : runnables.remove(playerName)) { diff --git a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java index af1679a2..9c76acd6 100644 --- a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java +++ b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java @@ -449,7 +449,7 @@ public class ReflectionManager { public static Object getNmsItem(ItemStack itemstack) { try { - return craftItemClass.getDeclaredMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack); + return craftItemClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, itemstack); } catch (Exception e) { e.printStackTrace(); @@ -784,6 +784,13 @@ public class ReflectionManager { catch (Exception ex) { 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) { Vector3F angle = (Vector3F) value; @@ -797,7 +804,7 @@ public class ReflectionManager { } } else if (value instanceof Direction) { try { - return (Enum) getNmsMethod("EnumDirection", "fromType1", int.class) + return getNmsMethod("EnumDirection", "fromType1", int.class) .invoke(null, ((Direction) value).ordinal()); } catch (Exception ex) {