Skip to content

Commit

Permalink
Refactor skin loading logic in NpcManagerImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Nov 23, 2024
1 parent 7fe99a1 commit 12ac7a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/main/java/de/oliver/fancynpcs/NpcManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,17 @@ public void loadNpcs() {
location = new Location(world, x, y, z, yaw, pitch);
}

SkinData skin = null;
String skinIdentifier = npcConfig.getString("npcs." + id + ".skin.identifier", npcConfig.getString("npcs." + id + ".skin.uuid", ""));
if (!skinIdentifier.isEmpty()) {
String skinVariantStr = npcConfig.getString("npcs." + id + ".skin.variant", SkinData.SkinVariant.AUTO.name());
SkinData.SkinVariant skinVariant = SkinData.SkinVariant.valueOf(skinVariantStr);

String skinVariantStr = npcConfig.getString("npcs." + id + ".skin.variant", SkinData.SkinVariant.AUTO.name());
SkinData.SkinVariant skinVariant = SkinData.SkinVariant.valueOf(skinVariantStr);

SkinData skin = FancyNpcs.getInstance().getSkinManagerImpl().getByIdentifier(skinIdentifier, skinVariant);
skin = FancyNpcs.getInstance().getSkinManagerImpl().getByIdentifier(skinIdentifier, skinVariant);
if (skin == null) {
logger.warn("Could not load skin for npc '" + id + "'");
}
}


if (npcConfig.isSet("npcs." + id + ".skin.value") && npcConfig.isSet("npcs." + id + ".skin.signature")) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/de/oliver/fancynpcs/skins/SkinManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ private SkinInfo executeRequest(GenerateRequest req) {
return null;
});

System.out.println("Fetching skin from MineSkin...");

return skinResp.join();
}

Expand Down

0 comments on commit 12ac7a7

Please sign in to comment.