Skip to content

Commit f0b99b5

Browse files
committed
XSkull - Fix the small mistake for older versions
1 parent 661a015 commit f0b99b5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

core/src/main/java/com/cryptomorin/xseries/profiles/PlayerProfiles.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ public static void removeTimestamp(MojangGameProfile profile) {
177177
* Tries to unwrap a {@link GameProfile} from a {@link net.minecraft.world.item.component.ResolvableProfile}.
178178
*/
179179
@Nullable
180-
public static GameProfile fromResolvableProfile(@Nullable Object profile) throws Throwable {
180+
public static MojangGameProfile fromResolvableProfile(@Nullable Object profile) throws Throwable {
181181
if (profile == null) return null;
182182
if (!(profile instanceof GameProfile) && ProfilesCore.ResolvableProfile_gameProfile != null) {
183183
// Unwrap from ResolvableProfile
184184
profile = ProfilesCore.ResolvableProfile_gameProfile.invoke(profile);
185185
}
186-
return (GameProfile) profile;
186+
return XGameProfile.of((GameProfile) profile);
187187
}
188188

189189
@Nullable
@@ -192,7 +192,7 @@ public static Object toResolvableProfile(@Nullable MojangGameProfile profile) th
192192
if (ProfilesCore.ResolvableProfile$bukkitSupports) {
193193
return ProfilesCore.ResolvableProfile$constructor.invoke(profile.object());
194194
} else {
195-
return profile;
195+
return profile.object();
196196
}
197197
}
198198

core/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public ItemMeta getObject() {
114114
@Override
115115
public MojangGameProfile getProfile() {
116116
try {
117-
return XGameProfile.of(PlayerProfiles.fromResolvableProfile(ProfilesCore.CraftMetaSkull_profile$getter.invoke((SkullMeta) meta)));
117+
return PlayerProfiles.fromResolvableProfile(ProfilesCore.CraftMetaSkull_profile$getter.invoke((SkullMeta) meta));
118118
} catch (Throwable throwable) {
119119
throw new IllegalStateException("Failed to get profile from item meta: " + meta, throwable);
120120
}
@@ -173,7 +173,7 @@ public Skull getObject() {
173173
@Override
174174
public MojangGameProfile getProfile() {
175175
try {
176-
return XGameProfile.of(PlayerProfiles.fromResolvableProfile(ProfilesCore.CraftSkull_profile$getter.invoke(state)));
176+
return PlayerProfiles.fromResolvableProfile(ProfilesCore.CraftSkull_profile$getter.invoke(state));
177177
} catch (Throwable throwable) {
178178
throw new IllegalStateException("Unable to get profile fr om blockstate: " + state, throwable);
179179
}

0 commit comments

Comments
 (0)