Add setPlayerProfile API for Skulls
This allows you to create already filled textures on Skulls to avoid texture lookups which commonly cause rate limit issues with Mojang API
This commit is contained in:
@@ -98,7 +98,22 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) {
|
||||
Preconditions.checkNotNull(profile, "profile");
|
||||
this.profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asResolvableProfileCopy(profile);
|
||||
}
|
||||
|
||||
@javax.annotation.Nullable
|
||||
@Override
|
||||
public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() {
|
||||
return profile != null ? new com.destroystokyo.paper.profile.CraftPlayerProfile(profile) : null;
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
@Deprecated // Paper
|
||||
public PlayerProfile getOwnerProfile() {
|
||||
if (!this.hasOwner()) {
|
||||
return null;
|
||||
@@ -108,11 +123,12 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // Paper
|
||||
public void setOwnerProfile(PlayerProfile profile) {
|
||||
if (profile == null) {
|
||||
this.profile = null;
|
||||
} else {
|
||||
this.profile = new ResolvableProfile(CraftPlayerProfile.validateSkullProfile(((CraftPlayerProfile) profile).buildGameProfile()));
|
||||
this.profile = CraftPlayerProfile.validateSkullProfile(((com.destroystokyo.paper.profile.SharedPlayerProfile) profile).buildResolvableProfile()); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user