fix: profile skin npe

This commit is contained in:
aro 2022-12-14 16:00:49 +01:00
parent 95453f24d1
commit 9a10ea2982
4 changed files with 8 additions and 4 deletions

View file

@ -87,6 +87,7 @@ public class v1_18_R1 implements Internals {
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
final CraftPlayer craftPlayer = (CraftPlayer) player;
final EntityPlayer entityPlayer = craftPlayer.getHandle();
final boolean changeOnlyName = profile.getSkin() != null && !profile.getSkin().equalsIgnoreCase(player.getName());
Optional<MojangSkin> skin;
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
@ -95,7 +96,7 @@ public class v1_18_R1 implements Internals {
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
if (skinChange || !profile.getSkin().equalsIgnoreCase(player.getName())) {
if (skinChange || changeOnlyName) {
try {
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
if (uuid.isPresent()) {