Skip to content

Commit

Permalink
Read skin files from plugins/FancyNpcs/skins dir
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Nov 23, 2024
1 parent 4e66e44 commit a1a7474
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/de/oliver/fancynpcs/skins/SkinManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

public class SkinManagerImpl implements SkinManager {

private final String SKINS_DIRECTORY = "plugins/FancyNpcs/skins/";

private final ScheduledExecutorService executor;
private final MineSkinClient client;

Expand All @@ -52,6 +54,11 @@ public SkinManagerImpl(SkinCache fileCache, SkinCache memCache) {

this.fileCache = fileCache;
this.memCache = memCache;

File skinsDir = new File(SKINS_DIRECTORY);
if (!skinsDir.exists()) {
skinsDir.mkdirs();
}
}

@Override
Expand Down Expand Up @@ -181,7 +188,7 @@ public SkinData getByFile(String filePath, SkinData.SkinVariant variant) {
return cached;
}

File file = new File(filePath);
File file = new File(SKINS_DIRECTORY + filePath);
if (!file.exists()) {
FancyNpcs.getInstance().getFancyLogger().error("File does not exist: " + filePath);
return null;
Expand Down

0 comments on commit a1a7474

Please sign in to comment.