From f0105a578f81b330ed8036260bd56705190d9a76 Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 2 Sep 2024 23:34:23 +0800 Subject: [PATCH] Simplify skin.applyAndRespawn slightly --- main/src/main/java/net/citizensnpcs/npc/skin/Skin.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/npc/skin/Skin.java b/main/src/main/java/net/citizensnpcs/npc/skin/Skin.java index 8cc551989..f4a6a9e63 100644 --- a/main/src/main/java/net/citizensnpcs/npc/skin/Skin.java +++ b/main/src/main/java/net/citizensnpcs/npc/skin/Skin.java @@ -85,18 +85,13 @@ public class Skin { if (skinName.equals(cachedName) && texture != null && !texture.equals("cache")) { setNPCTexture(entity, new SkinProperty("textures", texture, skinTrait.getSignature())); - // check if NPC prefers to use cached skin over the latest skin. - if (entity.getNPC().data().has("player-skin-use-latest")) { - entity.getNPC().data().remove("player-skin-use-latest"); - } if (!skinTrait.shouldUpdateSkins()) // cache preferred return true; } if (!hasSkinData()) { - String defaultSkinName = ChatColor.stripColor(npc.getName()).toLowerCase(Locale.ROOT); + String npcName = ChatColor.stripColor(npc.getName()).toLowerCase(Locale.ROOT); - if (npc.hasTrait(SkinTrait.class) && skinName.equals(defaultSkinName) - && !npc.getOrAddTrait(SkinTrait.class).fetchDefaultSkin()) + if (!skinTrait.shouldUpdateSkins() && !skinTrait.fetchDefaultSkin() && skinName.equals(npcName)) return false; if (hasFetched)