Skip to content

Commit

Permalink
Fix library manager attempting to load non-JAR files and folders
Browse files Browse the repository at this point in the history
  • Loading branch information
magicmq committed Sep 9, 2024
1 parent f5b363d commit 76fe4ee
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ private void initLibraries() {

for (File library : toLoad) {
String libName = library.getName();
if (!libName.endsWith("-relocated.jar")) {
try {
long start = System.nanoTime();
LoadResult result = loadLibrary(library);
long duration = System.nanoTime() - start;
if (result == LoadResult.SUCCESS)
PySpigot.get().getLogger().log(Level.INFO, "Loaded library " + libName + " in " + (duration / 1000000) + " ms");
} catch (Throwable throwable) {
PySpigot.get().getLogger().log(Level.SEVERE, "Unable to load library " + libName + "!", throwable);
if (libName.endsWith(".jar")) {
if (!libName.endsWith("-relocated.jar")) {
try {
long start = System.nanoTime();
LoadResult result = loadLibrary(library);
long duration = System.nanoTime() - start;
if (result == LoadResult.SUCCESS)
PySpigot.get().getLogger().log(Level.INFO, "Loaded library " + libName + " in " + (duration / 1000000) + " ms");
} catch (Throwable throwable) {
PySpigot.get().getLogger().log(Level.SEVERE, "Unable to load library " + libName + "!", throwable);
}
}
}
}
Expand Down

0 comments on commit 76fe4ee

Please sign in to comment.